npm ERR!对等部门丢失:firebase-admin @ ^ 7.0.0,firebase-functions @ 2.3.1要求

时间:2019-05-09 22:16:33

标签: firebase npm google-cloud-functions

我正在尝试了解如何获取所需的firebase-admin版本。我的情况是这样的:

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

运行npm update firebase-admin不会更改任何内容。

package.json包含以下行:

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

我该怎么办?

更新: 进行firebase serve时出现此错误:

!  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 个答案:

答案 0 :(得分:1)

'npm update'正在工作,但是package.json中针对“ firebase-admin”的'^'克拉将更新限制为6.x版本-因此它没有比6.5.1版本更新的内容

您可以在package.json中手动将“ firebase-admin”的版本更改为“ ^ 7.0.0”,然后运行“ npm install”。这将获取7.x.x范围内的最新版本。