繁体   English   中英

Cloud Functions 模拟器需要安装模块“firebase-admin”

[英]The Cloud Functions emulator requires the module "firebase-admin" to be installed

继续尝试让firebase serve再次工作。 我刚刚问了这个问题(并得到了很好的答复,谢谢): npm ERR:peer dep missing。 firebase-admin@^7.0,0. firebase-functions@2.3.1 要求

在执行npm list firebase-admin时,我现在看到预期的 output -- firebase-admin@7.3.0 firebase-admin@7.3.0 。

但是firebase serve仍然不起作用。 我明白了:

!  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)

所以firebase serve仍然没有看到 firebase firebase-admin模块。 到底是怎么回事? 我应该怎么办?

现在看来这个问题与您在本地安装的 Node 版本有关。

我不知道我的头顶上的答案,但开始环顾节点版本。

在您的 functions/package.json - 您可能需要指定要使用的节点版本( https://firebase.google.com/docs/functions/manage-functions ):

 // functions/package.json { "name": ..., "scripts": ..., "dependencies": ..., "engines": { "node": "10" } }

请注意,Node 10 在 Firebase 上仍处于测试阶段。

我看到了同样的事情,看起来您可以将您的 firebase-tools 版本降级到 6.8.0

npm install firebase-tools@6.8.0 -g

(我试过这个,它有效)

基本上这意味着您应该降级到节点 6 或 8,而不是升级到 10(因为系统中的节点版本是 10,而 Firebase 请求版本 6)。 Firebase 尚不支持 Node 10+ 甚至最新版本 12.15.0

打开终端并进入您的/myProject/functions文件夹。

然后,运行npm install

所有必需的模块都应出现在node_modules文件夹中。

删除node_module<\/code>文件夹。 在包含package.json<\/code>的目录中再次运行npm install<\/code> 。 这解决了我的问题。

"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM