不变违规:本机模块不能为空。 React Native Firebase 应用程序

Posted

技术标签:

【中文标题】不变违规:本机模块不能为空。 React Native Firebase 应用程序【英文标题】:Invariant Violation: Native module cannot be null. React Native Firebase app 【发布时间】:2020-12-13 17:30:59 【问题描述】:

我正在使用 firebase 开发 React Native 应用程序。 当我运行应用程序时,构建成功执行,但是当我在模拟器上安装应用程序时出现问题。我的应用程序中有以下节点模块:

“依赖”: "@fortawesome/fontawesome-svg-core": "^1.2.27", "@fortawesome/free-brands-svg-icons": "^5.12.1", "@fortawesome/free-regular-svg-icons": "^5.12.1", "@fortawesome/free-solid-svg-icons": "^5.12.1", "@fortawesome/react-native-fontawesome": "^0.2.2", "@react-native-community/google-signin": "^4.0.3", "@react-native-community/masked-view": "^0.1.10", "@react-native-community/toolbar-android": "0.1.0-rc.2", "@react-native-firebase/app": "^7.0.1", "@react-native-firebase/auth": "^7.0.2", "axios": "^0.19.2", "base-64": "^0.1.0", “火力基地”:“^7.8.2”, "formik": "^2.1.4", “本地基础”:“^2.13.8”, "qs": "^6.9.3", “反应”:“16.9.0”, “反应原生”:“0.61.5”, “react-native-app-intro-slider”:“4.0.4”, "react-native-awesome-alerts": "^1.3.2", “反应原生元素”:“^1.2.7”, "react-native-fbsdk": "^1.1.2", “反应原生手势处理程序”:“1.7.0”, "react-native-get-random-values": "^1.3.1", "react-native-image-picker": "^2.3.1", “反应原生离子”:“4.6.5”, “反应原生线性梯度”:“^2.5.6”, "react-native-looped-carousel": "^0.1.13", "react-native-media-controls": "^2.0.1", “反应原生模式”:“11.5.6”, "react-native-modal-loader": "^1.3.0", “反应原生模态框”:“2.0.0”, “反应原生模态”:“^0.19.9”, "react-native-orientation-locker": "^1.1.8", “反应原生像素完美”:“^1.0.2”, "react-native-progress": "^4.1.2", "react-native-reanimated": "^1.7.0", "react-native-responsive-ui": "^2.1.1", "react-native-safe-area-context": "^0.7.3", "react-native-screens": "^2.0.0-beta.8", “反应原生滑块”:“^0.11.0”, "react-native-snap-carousel": "^3.8.4", “反应原生声音”:“^0.11.0”, "react-native-stars": "^1.2.1", "react-native-svg": "^11.0.1", "react-native-vector-icons": "^6.6.0", “反应原生视频”:“^4.4.5”, "react-native-video-player": "^0.10.0", "react-native-webview": "^9.2.0", “反应导航”:“^4.1.1”, “反应导航抽屉”:“^2.3.4”, “反应导航堆栈”:“^2.1.1”, “反应导航选项卡”:“^2.7.0”, “反应导航转换”:“^1.0.12”, "react-redux": "^7.2.0", "redux": "^4.0.5", “是的”:“^0.28.1” ,

【问题讨论】:

【参考方案1】:

您是否尝试过先安装 pod?

首先进入ios目录

cd ios/ 

然后

pod install

然后再次尝试重建项目并在模拟器中启动它。

【讨论】:

以上是关于不变违规:本机模块不能为空。 React Native Firebase 应用程序的主要内容,如果未能解决你的问题,请参考以下文章

不变违规:本机模块不能为空。错误仅显示在 iOS 上

模块 AppRegistry 不是注册的可调用模块

不变违规:“RNSVGSvgView”的本机组件不存在

不变违规:元素类型无效 - React Native

在使用 React Native 的 IOS 运行时出现“未处理的 JS 异常:本机模块不能为空”错误

React Native 错误 - 不变违规:ART 已从 React Native 中删除