Reputation: 1613
I installed RNF from starter kit provided by Invertase. I am using RNF app, database, analytics, auth. Everything worked fine until I needed the auth module. It throws an error on app startup (on Android, haven't tried iOS):
...\node_modules\react-native\Libraries\Core\ExceptionsManager.js:86
You've attempted to require '@react-native-firebase/auth' version '6.0.3', however,
the '@react-native-firebase/app' module is of a different version (6.0.0).
All React Native Firebase modules must be of the same version.
Please ensure they match up in your package.json file and re-run yarn/npm install.
But I checked in package.json of all the modules are of version 6.0.3, and my package.json also looks good:
{
"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",
...
Import in 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'
Things I've tried:
npm install
Can't think of anything else to try, but the error does not go away. It's working fine with analytics and database, only auth is an issue.
Upvotes: 6
Views: 14960
Reputation: 5358
Also don't forget to remove ~ or ^ icon from version on package.json and all versions must be the same:
"@react-native-firebase/analytics": "18.8.0",
"@react-native-firebase/app": "18.8.0",
"@react-native-firebase/messaging": "18.8.0"
Upvotes: 0
Reputation: 18803
I had the same problem. You should note that all packages of @react-native-firebase/...
are equal to @react-native-firebase/app
.
To solve this problem you need to update the relevant packages
and then reset the npm cache
:
npm update @react-native-firebase/app
npm update @react-native-firebase/analytics
npm update @react-native-firebase/..
//all of the firebase packages (updated)And finally reset the npm cache
npm start -- --reset-cache
Upvotes: 3
Reputation: 1613
Found this to be an issue with the caches.
npm install
The project now has all RNF modules with version 6.0.3
Upvotes: 0
Reputation: 21
I created a project with:
npx @react-native-community/cli init --template=@react-native-firebase/template <name>
and I got this issue. But then I created a basic project like react-native init <name>
and I installed
@react-native-firebase/app @react-native-firebase/auth
or any product, and the issue improved.
Upvotes: 2