I’m developing a React Native app using Expo’s Snack, and I’m encountering issues with resolving the Firebase dependency. Here’s what I’ve done so far:
Problem:
I receive the following error when trying to use Firebase in my Snack project:
Failed to resolve dependency ‘[email protected]’ (Network request failed)
even i have changed versions, 8.0.0 was fine but It again gave such errors
Updated package.json:
I tried using the latest Firebase version as well as an older, more stable version.
{
"dependencies": {
"expo": "~48.0.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.72.4",
"firebase": "9.6.1", // Also tried with [email protected]
"@babel/runtime": "^7.18.9"
},
"devDependencies": {
"@types/react": "~17.0.21",
"@types/react-native": "~0.64.12",
"typescript": "~4.3.5"
}
}
Initialized Firebase in firebaseConfig.js:
import { initializeApp } from 'firebase/app';
import { getFirestore } from 'firebase/firestore';
const firebaseConfig = {
apiKey: "",
authDomain: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: ""
};
const app = initializeApp(firebaseConfig);
const db = getFirestore(app);
export { db };
Firebase Version Tried: 10.12.1 ,8.0.0 and 9.6.1
Environment: Expo Snack
Error Message: Failed to resolve dependency ‘[email protected]’ (Network request failed)
2
Answers
I also have the same problem. The paleactive form I was able to solve was through the downgrade of the Firebase version to 8.10.0 on Package.json
Follow the link with my example.
https://snack.expo.dev/@jacksonm/aula-react-native-twitter-2023-2
use "Firebase": "8.0.0",