React-Native Expo 应用程序突然无法运行,因为 Invariant Violation: 'main' has not been registered

Posted

技术标签:

【中文标题】React-Native Expo 应用程序突然无法运行,因为 Invariant Violation: \'main\' has not been registered【英文标题】:React-Native Expo app suddenly will not run because of Invariant Violation: 'main' has not been registeredReact-Native Expo 应用程序突然无法运行,因为 Invariant Violation: 'main' has not been registered 【发布时间】:2020-07-05 21:44:48 【问题描述】:

我正在使用 expo 构建一个 react 原生应用程序,并且它已经运行了好几天了。然而,不知从何而来,它开始给我一个 Invariant Violation: 'main' has not been registered issue,并阻止我构建应用程序。这是一张照片。Error as well as AppEntry.js file

另外,总的来说,我对 expo 和 react-native 还比较陌生,所以有些东西我还是不明白。我到处寻找答案,但没有任何效果。

【问题讨论】:

【参考方案1】:

对我有用的快速解决方案

    删除您的node_modules 文件夹 删除您的 yarn.lock 文件(如果您使用的是 yarn) 再次运行安装 npm iyarn(如果您使用的是 yarn)

【讨论】:

以上是关于React-Native Expo 应用程序突然无法运行,因为 Invariant Violation: 'main' has not been registered的主要内容,如果未能解决你的问题,请参考以下文章

expo 应用程序中的 React-native 安装问题

Expo 网络响应超时,无法在 Android 模拟器上运行 Expo 应用

使用 react-native (expo) 切换手电筒

React-Native (expo) 检索初始主题(或任何初始化值)

如何在 expo/react-native 应用程序中添加自定义节点模块?

对象不是 Expo(react-native) 应用程序中的函数