Typescript 所有React本机Firebase模块必须为同一版本-can';不要使用Auth

Typescript 所有React本机Firebase模块必须为同一版本-can';不要使用Auth,typescript,react-native,react-native-firebase,Typescript,React Native,React Native Firebase,我从Invertase提供的启动器套件中安装了RNF。我正在使用RNF应用程序、数据库、分析、身份验证。在我需要auth模块之前,一切都正常。它在应用程序启动时抛出错误(在Android上,尚未尝试iOS): 但是我签入的package.json所有模块都是6.0.3版本,我的package.json看起来也不错: { "name": "meditationapp", "version": "6.0.3", "private": true, "scripts": { "s

我从Invertase提供的启动器套件中安装了RNF。我正在使用RNF应用程序、数据库、分析、身份验证。在我需要auth模块之前,一切都正常。它在应用程序启动时抛出错误(在Android上,尚未尝试iOS):

但是我签入的package.json所有模块都是6.0.3版本,我的package.json看起来也不错:

{
  "name": "meditationapp",
  "version": "6.0.3",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "run:android": "react-native run-android",
    "run:ios": "react-native run-ios --simulator=\"iPhone 11 Pro Max\"",
    "build:apk": "cd android && ./gradlew assembleRelease",
    "test": "jest",
    "prepare": "patch-package",
    "storybook": "start-storybook -p 7007"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.6.2",
    "@react-native-community/netinfo": "^4.4.0",
    "@react-native-firebase/analytics": "6.0.3",
    "@react-native-firebase/app": "6.0.3",
    "@react-native-firebase/auth": "6.0.3",
    "@react-native-firebase/database": "6.0.3",
    "@typescript-eslint/eslint-plugin": "^2.3.3",
    "@typescript-eslint/parser": "^2.3.3",
    ...
在App.tsx中导入:

import firebase from '@react-native-firebase/app'
import database from '@react-native-firebase/database'
import analytics from '@react-native-firebase/analytics'
import auth from '@react-native-firebase/auth'
我尝试过的事情:

  • 删除节点模块并运行
    npm安装
  • 已安装v6.0.0而不是6.0.3
  • 删除android/app/build
  • 想不出还有什么可以尝试的,但错误不会消失。
    它在分析和数据库方面运行良好,只有身份验证是一个问题。

    发现这是缓存的一个问题

  • 我删除了npm缓存和metro bundler缓存(手动,在Windows上位于C:\Users\Appdata\Roaming)
  • 已删除项目中的node_modules文件夹
  • 运行npm安装

  • 该项目现在拥有6.0.3版的所有RNF模块。我创建了一个项目,其中包括:

    npx @react-native-community/cli init --template=@react-native-firebase/template <name>
    

    或任何产品,问题得到改善。

    我也有同样的问题。您应该注意,
    @react native firebase/…
    的所有包都等于
    @react native firebase/app

    要解决此问题,您需要
    更新相关软件包
    ,然后
    重置npm缓存

  • npm更新@react native firebase/app
  • npm更新@react native firebase/analytics
  • npm updatea@react native firebase/。
    //所有firebase包
  • 最后重置npm缓存

  • npm启动--reset cache

  • 我还必须删除metro bundler缓存,否则它仍在抱怨……我花了大约两个小时删除和安装node_模块和POD,但只是
    npm I--save
    工作得非常出色。我不知道该说什么。。。
    npx @react-native-community/cli init --template=@react-native-firebase/template <name>
    
    @react-native-firebase/app @react-native-firebase/auth