如何修复此Firebase函数部署错误?

How to fix this Firebase Function Deploy Error?

提问人:user633597 提问时间:10/19/2022 最后编辑:Nithish Kumar Ramisettyuser633597 更新时间:10/19/2022 访问量:199

问:

我在部署 Firebase 函数时遇到异常。有没有人遇到过这个奇怪的错误?我对错误消息感到困惑。

如果是这样,解决方案是什么?

我正在使用以下命令

firebase deploy --only functions:chapterpptx
i  deploying functions
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
i  functions: ensuring required API artifactregistry.googleapis.com is enabled...
✔  functions: required API artifactregistry.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled

Error: Error occurred while parsing your function triggers.

/Users/xxxxxx/Projects/nationals/functions/node_modules/firebase-admin/lib/app/firebase-app.js:174
        this.appStore?.removeApp(this.name);
                      ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:1052:16)
    at Module._compile (internal/modules/cjs/loader.js:1100:27)
    at Module._compile (pkg/prelude/bootstrap.js:1394:32)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1156:10)
    at Module.load (internal/modules/cjs/loader.js:984:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1024:19)
    at Module.require (pkg/prelude/bootstrap.js:1338:31)
    at require (internal/modules/cjs/helpers.js:72:18)

这是我对Firebase functions文件夹的package.json

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "serve": "firebase serve --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "16"
  },
  "dependencies": {
    "axios": "^1.1.3",
    "cors": "^2.8.5",
    "firebase": "^9.12.1",
    "firebase-admin": "^11.2.0",
    "firebase-functions": "^4.0.1",
    "xml-js": "^1.6.11"
  },
  "devDependencies": {
    "firebase-functions-test": "^0.1.6"
  },
  "private": true
}
Firebase 函数 部署

评论


答: 暂无答案