部署 firebase 应用程序时出错:命令需要范围
Error in deploying firebase application: command requires scopes
我正在学习如何使用 this 编写 Firebase 社交网络应用程序,复制代码并更改包含我的 API 密钥的 config.js
。但是,当我尝试 运行 firebase deploy
时,我收到以下错误消息。
[debug] [2020-05-20T16:21:50.072Z] ----------------------------------------------------------------------
[debug] [2020-05-20T16:21:50.073Z] Command: /usr/local/Cellar/node/13.13.0_1/bin/node /usr/local/bin/firebase deploy
[debug] [2020-05-20T16:21:50.073Z] CLI Version: 6.8.0
[debug] [2020-05-20T16:21:50.073Z] Platform: darwin
[debug] [2020-05-20T16:21:50.073Z] Node Version: v13.13.0
[debug] [2020-05-20T16:21:50.074Z] Time: Thu May 21 2020 00:21:50 GMT+0800 (Singapore Standard Time)
[debug] [2020-05-20T16:21:50.075Z] ----------------------------------------------------------------------
[debug]
[debug] [2020-05-20T16:21:50.083Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2020-05-20T16:21:50.084Z] > authorizing via signed-in user
[debug] [2020-05-20T16:21:50.084Z] [iam] checking project bean-65978 for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]
[debug] [2020-05-20T16:21:50.085Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/bean-65978:testIamPermissions
[debug] [2020-05-20T16:21:51.246Z] <<< HTTP RESPONSE 200
[debug] [2020-05-20T16:21:53.149Z] TypeError: Cannot read property 'wanted' of undefined
at /usr/local/lib/node_modules/firebase-tools/lib/checkFirebaseSDKVersion.js:37:51
at processTicksAndRejections (internal/process/task_queues.js:97:5)
[error]
[error] Error: An unexpected error has occurred.
这是我的package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase emulators:start --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "8"
},
"dependencies": {
"busboy": "^0.3.1",
"cors": "^2.8.5",
"express": "^4.17.1",
"firebase": "^7.14.4",
"firebase-admin": "^8.10.0",
"firebase-functions": "^3.6.1",
"firebase-tools": "^8.3.0",
"uuidv4": "^6.0.8"
},
"devDependencies": {
"eslint": "^5.12.0",
"eslint-plugin-promise": "^4.0.1",
"firebase-functions-test": "^0.2.0"
},
"private": true
}
有人知道我的代码有什么问题吗?
您使用的是非常旧版本的 Firebase CLI。输出表明您使用的是 6.8.0。我写这篇文章时的最新版本是 8.3.0。更新为 npm i -g firebase-tools
.
我正在学习如何使用 this 编写 Firebase 社交网络应用程序,复制代码并更改包含我的 API 密钥的 config.js
。但是,当我尝试 运行 firebase deploy
时,我收到以下错误消息。
[debug] [2020-05-20T16:21:50.072Z] ----------------------------------------------------------------------
[debug] [2020-05-20T16:21:50.073Z] Command: /usr/local/Cellar/node/13.13.0_1/bin/node /usr/local/bin/firebase deploy
[debug] [2020-05-20T16:21:50.073Z] CLI Version: 6.8.0
[debug] [2020-05-20T16:21:50.073Z] Platform: darwin
[debug] [2020-05-20T16:21:50.073Z] Node Version: v13.13.0
[debug] [2020-05-20T16:21:50.074Z] Time: Thu May 21 2020 00:21:50 GMT+0800 (Singapore Standard Time)
[debug] [2020-05-20T16:21:50.075Z] ----------------------------------------------------------------------
[debug]
[debug] [2020-05-20T16:21:50.083Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2020-05-20T16:21:50.084Z] > authorizing via signed-in user
[debug] [2020-05-20T16:21:50.084Z] [iam] checking project bean-65978 for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","firebase.projects.get"]
[debug] [2020-05-20T16:21:50.085Z] >>> HTTP REQUEST POST https://cloudresourcemanager.googleapis.com/v1/projects/bean-65978:testIamPermissions
[debug] [2020-05-20T16:21:51.246Z] <<< HTTP RESPONSE 200
[debug] [2020-05-20T16:21:53.149Z] TypeError: Cannot read property 'wanted' of undefined
at /usr/local/lib/node_modules/firebase-tools/lib/checkFirebaseSDKVersion.js:37:51
at processTicksAndRejections (internal/process/task_queues.js:97:5)
[error]
[error] Error: An unexpected error has occurred.
这是我的package.json
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"lint": "eslint .",
"serve": "firebase emulators:start --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "8"
},
"dependencies": {
"busboy": "^0.3.1",
"cors": "^2.8.5",
"express": "^4.17.1",
"firebase": "^7.14.4",
"firebase-admin": "^8.10.0",
"firebase-functions": "^3.6.1",
"firebase-tools": "^8.3.0",
"uuidv4": "^6.0.8"
},
"devDependencies": {
"eslint": "^5.12.0",
"eslint-plugin-promise": "^4.0.1",
"firebase-functions-test": "^0.2.0"
},
"private": true
}
有人知道我的代码有什么问题吗?
您使用的是非常旧版本的 Firebase CLI。输出表明您使用的是 6.8.0。我写这篇文章时的最新版本是 8.3.0。更新为 npm i -g firebase-tools
.