Expo firebase / firestore Android emulator


I am trying to build an app using Expo and firebase. But during the development, I run into issues I couldn’t resolve so I need help.
So my problem is the following.
When I run my android emulator I am getting the following error message.

› Reloading apps
Android Bundling failed 5755ms
While trying to resolve module `firebase` from file `C:\Users\mikad\OneDrive\Documenten\PersonalProjects\MobileApps\questionsApp\firebaseConfig.js`, the package `C:\Users\mikad\OneDrive\Documenten\PersonalProjects\MobileApps\questionsApp\node_modules\firebase\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`C:\Users\mikad\OneDrive\Documenten\PersonalProjects\MobileApps\questionsApp\node_modules\firebase\index`. Indeed, none of these files exist:

 * C:\Users\mikad\OneDrive\Documenten\PersonalProjects\MobileApps\questionsApp\node_modules\firebase\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
 * C:\Users\mikad\OneDrive\Documenten\PersonalProjects\MobileApps\questionsApp\node_modules\firebase\index\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)

I have tried the follwing:

1: Build a development app
Result: Getting a diffrend error: “network request failed”
2: Updating the metro.config.js

const { getDefaultConfig } = require("@expo/metro-config");

const defaultConfig = getDefaultConfig(__dirname);


module.exports = defaultConfig;

Result : nothing changed
3: Deleting node modules
Result: nothing changed
4: downgrading firebase
Result: nothing changed

Current versions:
“eas-cli”: “^0.55.1”,
“expo”: “^45.0.6”,
“firebase”: “9.6.11”,
“react-native”: “0.68.2”,

Any help is greatly appreciated because I don’t know what to do anymore.

Hey @mikadevries, since you are using Firebase version 9+, you might need to change your code to new version 9 API syntax. One significant change is that there is no need to write this import statement: import * as firebase from "firebase"; in your Firebase config file. For more info, please refer to Firebase docs.

Thank you so much. I didn’t know that the app would break if I did this

import * as firebase from 'firebase';

But because of your answer, it finally made sense.
You don’t know how happy I am that I finally works. I thought I had tried everything.

1 Like

Glad it is working :slight_smile:

I’d suggest going through Firebase SDK docs to learn more about changes that have come up with version 9 from time to time.