我在主应用程序中遇到这个问题,但正在处理另一个项目。当我单独运行 app.js 中的相关部分时,它会给出相同的错误(就像在其他项目中一样)。我用世博会。还有我的 package.json:
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"@expo/metro-runtime": "~3.1.3",
"@firebase/app": "^0.9.29",
"@firebase/auth": "^1.6.2",
"@firebase/database": "^1.0.3",
"@react-native-async-storage/async-storage": "^1.23.1",
"@react-native-community/masked-view": "^0.1.0",
"@react-native-firebase/app": "^18.7.3",
"@react-native-firebase/auth": "^18.7.3",
"@react-navigation/bottom-tabs": "*",
"@react-navigation/native": "6.0.0",
"@react-navigation/native-stack": "^6.9.12",
"@react-navigation/stack": "^6.3.16",
"@types/react": "~18.2.14",
"expo": "~50.0.14",
"expo-constants": "~14.4.2",
"expo-status-bar": "~1.11.1",
"firebase": "^10.11.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.73.6",
"react-native-dropdown-picker": "^5.4.6",
"react-native-firebase": "^5.6.0",
"react-native-gesture-handler": "~2.12.0",
"react-native-paper": "*",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.22.0",
"react-native-vector-icons": "^10.0.3",
"react-native-web": "~0.19.6",
"react-navigation": "*",
"react-navigation-stack": "*"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"react-native-modal": "^13.0.1"
},
"private": true
}
当我单独运行 app.js 中的相关部分时,它会给出相同的错误(就像在其他项目中一样)。
您正在混合使用 Firebase Web Client SDK (
firebase
) 和 React-Native-Firebase (@react-native-firebase
)。您几乎肯定不想这样做。 这里有一篇文章(披露:我写的)描述了这些差异。
此外,当您安装 Firebase Web Client SDK (
npm i firebase
) 时,您无需安装其子组件(@firebase/app
、@firebase/auth
等)
查看该错误消息附带的堆栈跟踪,您应该看到您自己的代码中调用 API 的位置导致了该错误。将来,提供完整的堆栈跟踪而不仅仅是错误消息会更有帮助。对您来说更有用的是跟踪代码中抛出错误的位置,然后与我们分享该代码的片段。