12

Continuing to try to get firebase serve to work again. I just asked this question (and got a good reply, thanks): npm ERR! peer dep missing: firebase-admin@^7.0.0, required by firebase-functions@2.3.1

When doing npm list firebase-admin I now see the expected output -- firebase-admin@7.3.0.

However firebase serve still does not work. I get this:

!  Your requested "node" version "6" doesn't match your global version "10"
...
!  The Cloud Functions emulator requires the module "firebase-admin" to be installed. This package is in your package.json, but it's not available. You probably need to run "npm install" in your functions directory.
i  functions: Your functions could not be parsed due to an issue with your node_modules (see above)

So firebase serve still does not see the firebase-admin module. What is going on? What should I do?

Leo
  • 4,136
  • 6
  • 48
  • 72

4 Answers4

9

I was seeing the same thing and it looks like you can downgrade your firebase-tools version to 6.8.0

npm install firebase-tools@6.8.0 -g

(I've tried this and it works)

Nick Ellsworth
  • 476
  • 3
  • 7
  • Thanks, this works. And it also solved the problem I reported here: https://stackoverflow.com/questions/56026747/firebase-console-log-on-localhost – Leo May 10 '19 at 11:52
  • This did not work for me. The emulator hits the function that is deployed to firebase instead of serving it from localhost. – Robert Moskal Jul 19 '19 at 19:02
8

It looks like this issue now relates to the Node version you have installed locally.

I don't know the answer off the top of my head, but start looking around the node versions.

In your functions/package.json - it may be that you need to specify which node version to use (https://firebase.google.com/docs/functions/manage-functions):

// functions/package.json

{
  "name": ...,
  "scripts": ...,
  "dependencies": ...,
  
  "engines": {
    "node": "10"
  }
 
}

Just be aware Node 10 is still in beta on Firebase.

Dharman
  • 30,962
  • 25
  • 85
  • 135
M.Lewis
  • 961
  • 8
  • 18
  • 2
    setting `"node": "8"` might also be an option. – Martin Zeitler May 09 '19 at 23:06
  • 2
    Thanks. I have installed `nvm` and is now using version 8. And I have changed to `"node": "8"`. I have deleted `package-lock.json` and `node_modules` and ran `npm install`. I still get the same error. – Leo May 10 '19 at 11:44
1

Basically it means that you should downgrade to either Node 6 or 8 not upgrade to 10 (As the node version in your system is 10 while Firebase is requesting version 6). Firebase does not yet support Node 10+ or even the latest version which is 12.15.0

Kimanthi K.
  • 595
  • 6
  • 13
  • 1
    now firebase-admin supports node 10 and above versions. they have mentioned that on their npm library page. https://www.npmjs.com/package/firebase-admin – Dulara Malindu Oct 27 '20 at 06:50
0

Delete the node_module folder. Run npm install again, in the directory containing package.json. This solved my problem.

secret
  • 237
  • 2
  • 6