无法创建新的Firebase项目:无法将Firebase添加到Google Cloud Platform项目。403权限被拒绝
这是我第一次学习Flutter和 Firebase。
我尝试在名为 "notes" 的Flutter项目中,使用命令 flutterfire configure 创建一个新项目。
这就是我得到的结果:
PS D:\courses\flutter\notes> flutterfire configure
i Found 1 Firebase projects.
✔ Select a Firebase project to configure your Flutter application with · <create a new project>
✔ Enter a project id for your new Firebase project (e.g. my-cool-project) · notes-cyberwolf-1
⠸ Creating new Firebase project notes-cyberwolf-1...
FirebaseCommandException: An error occured on the Firebase CLI when attempting to run a command.
COMMAND: firebase projects:create notes-cyberwolf-1 --json
ERROR: Failed to add Firebase to Google Cloud Platform project. See firebase-debug.log for more info.
这是firebase-debug.log:
[debug] [2026-06-21T11:53:01.615Z] ----------------------------------------------------------------------
[debug] [2026-06-21T11:53:01.617Z] Command: C:\nvm4w\nodejs\node.exe C:\nvm4w\nodejs\node_modules\firebase-tools\lib\bin\firebase.js projects:create notes-cyberwolf-1 --json
[debug] [2026-06-21T11:53:01.617Z] CLI Version: 15.22.0
[debug] [2026-06-21T11:53:01.617Z] Platform: win32
[debug] [2026-06-21T11:53:01.617Z] Node Version: v24.16.0
[debug] [2026-06-21T11:53:01.617Z] Detected Agent: unknown
[debug] [2026-06-21T11:53:01.617Z] Time: Sun Jun 21 2026 12:53:01 GMT+0100 (Central European Standard Time)
[debug] [2026-06-21T11:53:01.617Z] ----------------------------------------------------------------------
[debug]
[debug] [2026-06-21T11:53:01.621Z] > 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] [2026-06-21T11:53:01.621Z] > authorizing via signed-in user ([email protected])
[debug] [2026-06-21T11:53:01.623Z] Checked if tokens are valid: true, expires at: 1782046288370
[debug] [2026-06-21T11:53:01.623Z] Checked if tokens are valid: true, expires at: 1782046288370
[debug] [2026-06-21T11:53:01.624Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects [none]
[debug] [2026-06-21T11:53:01.624Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects {"projectId":"notes-cyberwolf-1","name":"notes-cyberwolf-1"}
[debug] [2026-06-21T11:53:02.566Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects 200
[debug] [2026-06-21T11:53:02.566Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects {"name":"operations/create_project.global.8491709320642598478"}
[debug] [2026-06-21T11:53:02.567Z] Checked if tokens are valid: true, expires at: 1782046288370
[debug] [2026-06-21T11:53:02.567Z] Checked if tokens are valid: true, expires at: 1782046288370
[debug] [2026-06-21T11:53:02.567Z] >>> [apiv2][query] GET https://cloudresourcemanager.googleapis.com/v1/operations/create_project.global.8491709320642598478 [none]
[debug] [2026-06-21T11:53:03.256Z] <<< [apiv2][status] GET https://cloudresourcemanager.googleapis.com/v1/operations/create_project.global.8491709320642598478 200
[debug] [2026-06-21T11:53:03.257Z] <<< [apiv2][body] GET https://cloudresourcemanager.googleapis.com/v1/operations/create_project.global.8491709320642598478 {"name":"operations/create_project.global.8491709320642598478"}
[debug] [2026-06-21T11:53:03.759Z] [Project Creation Poller] Retrying task index 0
[debug] [2026-06-21T11:53:03.760Z] Checked if tokens are valid: true, expires at: 1782046288370
[debug] [2026-06-21T11:53:03.760Z] Checked if tokens are valid: true, expires at: 1782046288370
[debug] [2026-06-21T11:53:03.760Z] >>> [apiv2][query] GET https://cloudresourcemanager.googleapis.com/v1/operations/create_project.global.8491709320642598478 [none]
[debug] [2026-06-21T11:53:03.969Z] <<< [apiv2][status] GET https://cloudresourcemanager.googleapis.com/v1/operations/create_project.global.8491709320642598478 200
[debug] [2026-06-21T11:53:03.969Z] <<< [apiv2][body] GET https://cloudresourcemanager.googleapis.com/v1/operations/create_project.global.8491709320642598478 {"name":"operations/create_project.global.8491709320642598478"}
[debug] [2026-06-21T11:53:04.980Z] [Project Creation Poller] Retrying task index 0
[debug] [2026-06-21T11:53:04.981Z] Checked if tokens are valid: true, expires at: 1782046288370
[debug] [2026-06-21T11:53:04.981Z] Checked if tokens are valid: true, expires at: 1782046288370
[debug] [2026-06-21T11:53:04.981Z] >>> [apiv2][query] GET https://cloudresourcemanager.googleapis.com/v1/operations/create_project.global.8491709320642598478 [none]
[debug] [2026-06-21T11:53:05.185Z] <<< [apiv2][status] GET https://cloudresourcemanager.googleapis.com/v1/operations/create_project.global.8491709320642598478 200
[debug] [2026-06-21T11:53:05.185Z] <<< [apiv2][body] GET https://cloudresourcemanager.googleapis.com/v1/operations/create_project.global.8491709320642598478 {"name":"operations/create_project.global.8491709320642598478","metadata":{"@type":"type.googleapis.com/google.cloudresourcemanager.v1.ProjectCreationStatus","gettable":true,"ready":true},"done":true,"response":{"@type":"type.googleapis.com/google.cloudresourcemanager.v1.Project","projectNumber":"153615364899","projectId":"notes-cyberwolf-1","lifecycleState":"ACTIVE","name":"notes-cyberwolf-1","createTime":"2026-06-21T11:53:02.175Z"}}
[debug] [2026-06-21T11:53:05.186Z] Checked if tokens are valid: true, expires at: 1782046288370
[debug] [2026-06-21T11:53:05.186Z] Checked if tokens are valid: true, expires at: 1782046288370
[debug] [2026-06-21T11:53:05.186Z] >>> [apiv2][query] POST https://firebase.googleapis.com/v1beta1/projects/notes-cyberwolf-1:addFirebase [none]
[debug] [2026-06-21T11:53:06.551Z] <<< [apiv2][status] POST https://firebase.googleapis.com/v1beta1/projects/notes-cyberwolf-1:addFirebase 403
[debug] [2026-06-21T11:53:06.551Z] <<< [apiv2][body] POST https://firebase.googleapis.com/v1beta1/projects/notes-cyberwolf-1:addFirebase {"error":{"code":403,"message":"The caller does not have permission","status":"PERMISSION_DENIED"}}
[debug] [2026-06-21T11:53:06.553Z] Request to https://firebase.googleapis.com/v1beta1/projects/notes-cyberwolf-1:addFirebase had HTTP Error: 403, The caller does not have permission
[debug] [2026-06-21T11:53:06.555Z] FirebaseError: Request to https://firebase.googleapis.com/v1beta1/projects/notes-cyberwolf-1:addFirebase had HTTP Error: 403, The caller does not have permission
at responseToError (C:\Users\aymen\AppData\Local\nvm\v24.16.0\node_modules\firebase-tools\lib\responseToError.js:53:12)
at RetryOperation._fn (C:\Users\aymen\AppData\Local\nvm\v24.16.0\node_modules\firebase-tools\lib\apiv2.js:333:77)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
[error]
[error] Error: Failed to add Firebase to Google Cloud Platform project. See firebase-debug.log for more info.
我不知道该怎么修复这个403 PERMISSION_DENIED错误。
解决方案
我不确定造成403错误的原因,但最简单的修复方法可能是在 Firebase控制台 中,将现有的Google Cloud项目连接到Firebase。
根据 如何将Firebase添加到现有的Google Cloud项目 的文档,如今的做法是:
- 前往 Firebase控制台
- 点击
Create new Firebase project - 在左下角点击
Add Firebase to Google Cloud project - 在
Select a Google Cloud project字段中选择你的项目
完成后,你可以重新运行 flutterfire CLI,选择Firebase项目(而不是创建一个新项目)。
站内所有文章版权归属LeftHeroAI导航站,无授权禁止任何主体转载、抄袭、复制内容,亦不得私自架设镜像站点。一经侵权,本站将通过法律途径追责。