gpt4 book ai didi

node.js - 运行Firebase服务时Firebase找不到 'firebase-admin'模块

转载 作者:太空宇宙 更新时间:2023-11-04 01:22:09 24 4
gpt4 key购买 nike

我在本地运行我的应用程序,但遇到此错误:

"i  Starting emulators: ["functions","hosting"]
⚠ Your requested "node" version "8" doesn't match your global version "12"
✔ functions: Emulator started at http://localhost:5001
i hosting: Serving hosting files from: public
✔ hosting: Local server: http://localhost:5000
✔ hosting: Emulator started at http://localhost:5000
i functions: Watching "/Users/nico/Documents/nexow/nexow-api-firebase/functions" for Cloud Functions...
⚠ Error: Cannot find module 'firebase-admin'
Require stack:
- /Users/nico/.nvm/versions/node/v12.6.0/lib/node_modules/firebase-tools/lib/emulator/functionsEmulatorRuntime.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)
at Function.Module._load (internal/modules/cjs/loader.js:527:27)
at Module.require (internal/modules/cjs/loader.js:683:19)
at Object.<anonymous> (/Users/nico/Documents/nexow/nexow-api-firebase/functions/node_modules/express-firebase-middleware/lib/auth.middleware.js:10:26)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:643:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:683:19)
at require (internal/modules/cjs/helpers.js:16:16)
⚠ We were unable to load your functions code. (see above)"

我已经完成了所有 NPM 安装,但没办法...几个小时前它还可以工作,最近停止工作了。我的合作伙伴正在运行相同的代码,并且它对他有用。

有谁知道问题出在哪里吗?

这是我的 package.json:

{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "8"
},
"dependencies": {
"express": "^4.17.1",
"firebase-admin": "*",
"firebase-functions": "^3.3.0"
},
"devDependencies": {
"eslint": "^5.12.0",
"eslint-plugin-promise": "^4.0.1",
"firebase-functions-test": "^0.1.6"
},
"private": true
}

谢谢!

最佳答案

这是一个已知问题,该问题已在 github 上打开 here

因此,解决方法是将系统降级到 Node8,因为它是您要使用的引擎。

关于node.js - 运行Firebase服务时Firebase找不到 'firebase-admin'模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58841887/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com