【问题标题】:Firebase deploy error : TS2694: Namespace 'admin' has no exported member 'appCheck'Firebase 部署错误:TS2694:命名空间 'admin' 没有导出的成员 'appCheck'
【发布时间】:2021-08-05 18:30:22
【问题描述】:

我正在尝试 Firebase 云功能的基本设置。 index.ts 包括一个hello world。但是在部署 firebase 云功能时出现以下错误。

node_modules/firebase-functions/lib/providers/https.d.ts:109:25 - error TS2694: Namespace 'admin' has no exported member 'appCheck'.
109         token: firebase.appCheck.DecodedAppCheckToken;
Found 1 error.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ build: `tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the functions@ build script.

Package.json 文件:

{
 "name": "functions",
 "scripts": {
   "lint": "tslint --project tsconfig.json",
   "build": "./node_modules/.bin/tsc",
   "serve": "npm run build && firebase serve --only functions",
   "shell": "npm run build && firebase functions:shell",
   "start": "npm run shell",
   "deploy": "firebase deploy --only functions",
   "logs": "firebase functions:log"
 },
 "engines": {
   "node": "8"
 },
 "main": "lib/index.js",
 "dependencies": {
   "firebase-admin": "^8.6.0",
   "firebase-functions": "^3.3.0"
 },
 "devDependencies": {
   "tslint": "^5.12.0",
   "typescript": "^3.3.1",
   "firebase-functions-test": "^0.1.6"
 },
 "private": true
}

tsconfig.json 文件

{
 "compilerOptions": {
   "module": "commonjs",
   "noImplicitReturns": true,
   "noUnusedLocals": true,
   "outDir": "lib",
   "sourceMap": true,
   "strict": true,
   "target": "es2017"
 },
 "typeRoots": [ "node_modules/@types" ],
 "compileOnSave": true,
 "include": [
   "src"
 ]
}

我已经运行了npm install firebase-admin@latest firebase-functions@latest 以获得最新的firebase 依赖项。

什么可能导致这个问题?

【问题讨论】:

  • 今天也打这个⚠ functions: package.json indicates an outdated version of firebase-functions. Please upgrade using npm install --save firebase-functions@latest in your functions directory.不应该运行:-(

标签: node.js firebase google-cloud-functions tslint


【解决方案1】:

直到有更好的答案

npm i -S firebase-functions@3.13.2

回滚到上一个功能版本

【讨论】:

    【解决方案2】:

    firebaser 在这里

    更新:这已在 firebase-functions@3.14.1 中修复,因此升级到该版本应该会删除错误消息。

    如果您对该版本仍有同样的问题,请在下方留言。


    上一个答案?

    我四处询问,从我听到的最新消息中得知,这个最新的firebase-functions SDK 需要 Admin SDK 9.8.0 和 Node v10 才能工作。

    我们的团队正在积极进行修复,因此我希望它在未来几周内会变得更好/更清晰。

    【讨论】:

      猜你喜欢
      • 2018-06-16
      • 1970-01-01
      • 2018-06-26
      • 1970-01-01
      • 2018-03-21
      • 2021-11-11
      • 2018-03-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多