npm ERR! peer dep missing: firebase-admin@^7.0.0,

2019-07-29 10:01发布

问题:

I am trying to understand how to get the version of firebase-admin that is required. My scenario is this:

MYPATH\functions>npm list firebase-admin
functions@ MYPATH\functions
`-- UNMET PEER DEPENDENCY firebase-admin@6.5.1

npm ERR! peer dep missing: firebase-admin@^7.0.0, required by firebase-functions@2.3.1

Running npm update firebase-admin does not change anything.

package.json contains this line:

"dependencies": {
  ...
  "firebase-admin": "^6.5.1",

What am I supposed to do?

UPDATE: When doing firebase serve I get this error:

!  Your requested "node" version "6" doesn't match your global version "10"
....
+  hosting: Local server: http://localhost:5000
!  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)

回答1:

'npm update' is working, however the '^' carat against "firebase-admin" in your package.json will limit the updates to the 6.x releases - so it's not getting anything newer then the 6.5.1 release.

You can manually change the version of "firebase-admin" in your package.json to "^7.0.0" and then run 'npm install'. This will grab the latest release in the 7.x.x range.