10

"firebase" is added as a dependency in your project's package.json but it doesn't seem to be installed. Please run "yarn" or "npm install" to fix this issue.

I am getting this error while running react-native on expo-cli locally. I have firebase-7.9.0 and expo- ^40.0.0 in my dependencies still it is showing this error.

shweta gawhad
  • 101
  • 1
  • 3

2 Answers2

20

If you are using expo, you are supposed to install firebase using expo.

expo install firebase

Ayesha Khan
  • 434
  • 4
  • 8
17

I added @ before firebase and the build worked.

"dependencies": {
    "expo": "~41.0.1",
    "@firebase": "^9.0.0-beta.2",
    ...
  },
akerra
  • 1,017
  • 8
  • 18
  • This is not valid. Please refer to the [package.json specifications](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#dependencies). Also, the dependencies are not the problem. – Shivam Jun 11 '21 at 23:24
  • @Shivam welp, it worked when deleting the cache and package.lock didn't ¯\_(ツ)_/¯ – akerra Jun 11 '21 at 23:38
  • It would work without the `@` though. You should not really use out-of-spec things like this. – Shivam Jun 17 '21 at 01:56
  • 3
    Although it's not to spec, this is the only solution that has worked thus far. I have no idea how you arrived at this but this hack works until another solution is suggested! Note: this breaks following npm installs so you have to remove the "@" prior to running it. – Noah Jul 21 '21 at 04:51
  • Can't see how this would work reliably, pointing at the `@firebase` folder likely only works if you're not using any `/compat` imports as that's under the `firebase` folder – Ally Sep 11 '21 at 22:16
  • 1
    I'm having the same issue with an Expo managed app: Changing the dependency from ```"firebase": "^9.0.2",``` to ```"@firebase": "^9.0.2",``` or ```"firebase9": "^9.0.2",``` solves the issue when running the app. But whenever I need to install a new package, I need to switch back to ```"firebase": "^9.0.2",``` otherwise yarn gets confused. Any ideas of a workaround that? – Felipe Chernicharo Sep 13 '21 at 15:55
  • This also works here, as I need a version greater than Expo one. Any better solution than waiting for Expo 43? – Henrique Bruno Sep 28 '21 at 20:34