javascript - 安装 react 原生 Firebase 存储后出现错误

标签 javascript reactjs firebase react-native

所以我正在使用我的 React Native 应用程序,并且必须安装 react-native firebase 存储来存储图像。所以我跑了 npm install @react-native-firebase/storage 安装它后,我重新运行我的服务器,然后,我收到了这个错误。我不知道为什么我会收到这个错误。请帮帮我。
收到此错误:

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
F:\Salvador\node_modules\@react-native-firebase\storage\android\src\main\java\io\invertase\firebase\storage\ReactNativeFirebaseStorageModule.java:234: error: cannot find symbol
    firebaseStorage.useEmulator(host, port);
                   ^
  symbol:   method useEmulator(String,int)
  location: variable firebaseStorage of type FirebaseStorage
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-firebase_storage:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 12s

    at makeError (F:\Salvador\node_modules\execa\index.js:174:9)
    at F:\Salvador\node_modules\execa\index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async runOnAllDevices (F:\Salvador\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
    at async Command.handleAction (F:\Salvador\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:186:9)
info Run CLI with --verbose flag for more details.

当我运行我的服务器时,我收到了这个错误

info Run CLI with --verbose flag for more details.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Salvador@0.0.1 android: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Salvador@0.0.1 android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Home\AppData\Roaming\npm-cache\_logs\2021-06-02T14_16_46_571Z-debug.log

最佳答案

如果其他人收到此错误,您需要做的是在 Android Studio 中打开您的 react native android 文件夹,然后通过 Android Studio 构建和运行您的应用程序。关闭 Android Studio 后,它将成功运行项目,现在再次启动您的 react native 项目。
现在你会得到 0 个错误。
另外,运行 npm 已过时 在运行之后尝试升级你过时的软件包,因为我的存储版本是 12.0,但是 firebase 的 auth 和应用程序是 11.2。

关于javascript - 安装 react 原生 Firebase 存储后出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67808109/

相关文章:

javascript - React 功能组件 vs 经典组件

javascript - componentDidMount 中的异步函数在第二次挂载 react 时不起作用

javascript - 在javascript字符串中添加html标签

java - 是否可以使用 Firebase Admin SDK 将消息发送到 FCM 客户端的一批 token ?

Firebase 部署错误 - 找不到模块 'firebase'

javascript - jQuery.slideUp 的问题

php - ckeditor - 无法禁用高级内容过滤器

javascript - 如何在 Google 文档脚本中加粗一行?

firebase - firebase 中的无崩溃 session 指标在哪里?

javascript - 确保某个脚本在另一个脚本之前加载