简体   繁体   中英

Error in deploying firebase application: command requires scopes

I am learning how to write a Firebase Social Networking application with this , copied the code and changed the config.js which contains my API key. However when I try running firebase deploy I get the following error message.

[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.

This is my 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
}

Does anyone know what's wrong with my code?

You are using a very old version of the Firebase CLI. The output suggests you are on 6.8.0. The latest version at the time I write this is 8.3.0. Update it with npm i -g firebase-tools .

Log out and then back into the firebase cli;

$ firebase logout $ firebase login

or

$ firebase login --reauth

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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