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 - knockout 事件绑定(bind)意外行为

javascript - 在 AngularJS 中仅显示日期

javascript - 调整浏览器大小时,CSS3 转换后的 div 会移动

javascript - 我们应该将 Jquery 与 React 一起使用吗?有什么好处和坏处

ios - 使用google帐户登录后如何执行segue?

ios - 自定义 Firebase 数据服务类 : Swift 3

javascript - 为什么 reduce() 跳过方括号?

javascript - 用于旋转光盘的 JQuery/JavaScript

reactjs - react native "The expo SDK requires Expo to run. .... this code is not running on Expo."

angular - 如何用FirebaseObservableList填充primeng <p-datatable>?