繁体   English   中英

错误:无法获取 Firebase 项目构建。 请确保该项目存在并且您的帐户有权访问它

[英]Error: Failed to get Firebase project build. Please make sure the project exists and your account has permission to access it

package json:

 "scripts": { "start": "react-scripts start", "build": "react-scripts build", "build:dev": "CI=false env-cmd -f.env.local npm run build && firebase deploy -P build", "test": "react-scripts test", "eject": "react-scripts eject" },

运行 npm 时运行 build:dev 返回:

错误:无法获取 Firebase 项目构建。 请确保该项目存在并且您的帐户有权访问它。

firebase-debug.log:

 [debug] [2022-01-29T23:34:29.653Z] <<< HTTP RESPONSE 200 {"date":"Sat, 29 Jan 2022 23:34:29 GMT","pragma":"no-cache","expires":"Mon, 01 Jan 1990 00:00:00 GMT","cache-control":"no-cache, no-store, max-age=0, must-revalidate","content-type":"application/json; charset=utf-8","vary":"X-Origin, Referer, Origin,Accept-Encoding","server":"scaffolding on HTTPServer2","x-xss-protection":"0","x-frame-options":"SAMEORIGIN","x-content-type-options":"nosniff","alt-svc":"h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"","accept-ranges":"none","transfer-encoding":"chunked"} [debug] [2022-01-29T23:34:29.700Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/build [none] [debug] [2022-01-29T23:34:29.967Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/build 403 [debug] [2022-01-29T23:34:29.967Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/build {"error":{"code":403,"message":"The caller does not have permission","status":"PERMISSION_DENIED"}} [debug] [2022-01-29T23:34:29.967Z] HTTP Error: 403, The caller does not have permission [debug] [2022-01-29T23:34:30.049Z] FirebaseError: HTTP Error: 403, The caller does not have permission at module.exports (/usr/local/lib/node_modules/firebase-tools/lib/responseToError.js:38:12) at Client.doRequest (/usr/local/lib/node_modules/firebase-tools/lib/apiv2.js:241:23) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Client.request (/usr/local/lib/node_modules/firebase-tools/lib/apiv2.js:96:20) at async getFirebaseProject (/usr/local/lib/node_modules/firebase-tools/lib/management/projects.js:290:21) at async getDefaultHostingSite (/usr/local/lib/node_modules/firebase-tools/lib/getDefaultHostingSite.js:8:21) at async requireHostingSite (/usr/local/lib/node_modules/firebase-tools/lib/requireHostingSite.js:9:18) at async Object.fn (/usr/local/lib/node_modules/firebase-tools/lib/commands/deploy.js:73:9) at async /usr/local/lib/node_modules/firebase-tools/lib/command.js:188:17 [error] [error] Error: Failed to get Firebase project build. Please make sure the project exists and your account has permission to access it.

在调试中获取https://firebase.googleapis.com/v1beta1/projects/build错误:

 { error: { code: 401, message: "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", status: "UNAUTHENTICATED", details: [ { @type: "type.googleapis.com/google.rpc.ErrorInfo", reason: "CREDENTIALS_MISSING", domain: "googleapis.com", metadata: { method: "google.firebase.service.v1beta1.FirebaseProjectService.GetFirebaseProject", service: "firebase.googleapis.com" } } ] } }

我努力了:

  • firebase 登录/注销
  • firebase 使用 --add
  • firebase 登录 --reauth

仍然显示相同的错误; 我在这里做错了什么?

运行这个

试试firebase login --reauth

对我有用的是运行firebase use <insert project alias> 运行之后,一切正常。

将 cli 中的 fb 别名更改为项目名称 + 更改

 "build:dev": "CI=false env-cmd -f.env.local npm run build && firebase deploy -P riplir",

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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