'The Cloud Functions emulator requires the module "firebase-admin" to be installed
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 [email protected]
When doing npm list firebase-admin I now see the expected output -- [email protected].
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?
Solution 1:[1]
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.
Solution 2:[2]
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
Solution 3:[3]
Delete the node_module folder.
Run npm install again, in the directory containing package.json.
This solved my problem.
Solution 4:[4]
Open the terminal and go into your /myProject/functions folder.
Then, run npm install
All the necessary modules should appear in the node_modules folder.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dharman |
| Solution 2 | Kimanthi K. |
| Solution 3 | secret |
| Solution 4 |
