首页 > 解决方案 > React-Native:不变违规:模块 AppRegistry 不是注册的可调用模块(调用 runApplication)

问题描述

我的应用在 Xcode 中构建,在 ios 模拟器上弹出启动画面,然后什么也没有发生。我尝试重新启动 Metro 捆绑器、擦除 Metro 捆绑器的缓存、重新安装所有 pod、重新安装所有节点模块并重新构建应用程序。我从 Xcode 终端收到以下反馈:

2020-04-24 17:02:50.186 [error][tid:com.facebook.react.JavaScript] TypeError: undefined is not an object (evaluating '_argonTheme.argonTheme.COLORS')
2020-04-24 17:02:50.190 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: TypeError: undefined is not an object (evaluating '_argonTheme.argonTheme.COLORS')
2020-04-24 17:02:50.198 [error][tid:com.facebook.react.JavaScript] Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
2020-04-24 17:02:50.376 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

标签: xcodereact-native

解决方案


对我来说,这是由错误的导入语句引起的。Xcode 终端提供的细节很少,所以我不得不注释掉每个屏幕上的每个导入语句以找到罪魁祸首。


推荐阅读