“您尝试通过调用 firebase.app() 使用未在项目上本机安装的 Firebase 模块。”升级 React Native 后

问题描述 投票:0回答:1

ERROR 错误:您尝试通过调用 firebase.app() 使用未在项目上本机安装的 Firebase 模块。

确保您已安装 npm 包“@react-native-firebase/app”,已将其导入到您的项目中,并已重建您的本机应用程序。

此错误位于: 在应用程序中 在RCTView中(由View创建) 在视图中(由 AppContainer 创建) 在ChildrenWrapper(由Root创建)中 在 _default 中(由 Root 创建) 在 Root 中(由 AppContainer 创建) 在RCTView中(由View创建) 在视图中(由 AppContainer 创建) 在应用程序容器中 在 Integrity(RootComponent) 中,js 引擎:hermesenter image description here

将 React Native 从 0.68.4 升级到 0.73.4 后,我使用 Yarn 重新安装了 Firebase。

我仔细检查了 MainApplication.java 中的 Firebase 设置,以确保 Firebase 应用模块已正确导入。

我还验证了我的 Firebase 初始化代码 (firebase.app()) 已正确实现,并且此设置在升级之前完美运行。

我希望 Firebase 模块能够像 React Native 版本升级之前一样初始化并工作,并且不会出现本机模块错误。我希望升级后,Firebase 能够继续顺利地集成到我的项目中,不会出现任何问题。

javascript typescript firebase react-native
1个回答
0
投票

我相信您正在使用旧的 firebase 语法。就像 V8 会使用 firebase.app() 一样。在 V9+(最新 10)中,您可以从“firebase/app”导入 {initializeApp};并执行 const app =initializeApp(firebaseConfig); 。我希望这有帮助。您还可以要求 AI 为您提供有关 V8 与 V9 的更多详细信息,因为我的回答可能会令人困惑。

© www.soinside.com 2019 - 2024. All rights reserved.