简体   繁体   English

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

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

I tried running firebase deploy like I have always done but came across this Error:我尝试像往常一样运行firebase deploy但遇到了这个错误:

Error: Failed to get Firebase project project-name.错误:无法获取 Firebase 项目项目名称。 Please make sure the project exists and your account has permission to access it.请确保该项目存在并且您的帐户有权访问它。

I have run firebase login and I get 'Already logged in as email@example.com'我运行了firebase login ,我得到“已经以 email@example.com 身份登录”

The firebase-debug.log file shows a few 401 http responses and some of them have the following text: firebase-debug.log文件显示了几个 401 http 响应,其中一些具有以下文本:

'Request had invalid authentication credentials' and also 'invalid token' “请求具有无效的身份验证凭据”和“无效的令牌”

How can this be solved?如何解决?

For me this worked,对我来说,这有效,

firebase logout

firebase login

This worked for me:这对我有用:

Run

firebase use --add firebase 使用 --add

And re-select the project并重新选择项目

Simply简单地

use firebase login --reauth使用firebase login --reauth

sometimes there is a token error you can check debug.log有时会出现令牌错误,您可以检查debug.log

Error Message in debug.log: [debug] [2020-10-13T23:01:28.050Z] <<< HTTP RESPONSE BODY {"error":{"code":401,"message":"Request had invalid authentication credentials. 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"}} debug.log 中的错误消息: [debug] [2020-10-13T23:01:28.050Z] <<< HTTP RESPONSE BODY {"error":{"code":401,"message":"Request had invalid authentication credentials. 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"}}

Solution of error use错误使用的解决方法

firebase login --reauth

and again firebase init for reinitializing the project select project and再次firebase init用于重新初始化项目 select 项目和

firebase deploy

Try logging out of firebase CLI and then log back in with the account that has the project that you are trying to run.尝试注销 firebase CLI,然后使用您尝试运行的项目的帐户重新登录。

This was the case with me.我就是这种情况。 I was logged in to another firebase account.我登录到另一个 firebase 帐户。

Steps:脚步:

  1.  `firebase logout`
  2.  `firebase login`

Run

firebase use --add firebase 使用 --add

And re-select the project并重新选择项目

This works 100%这工作 100%

Disconnecting the company's VPN and trying it again worked for me.断开公司的 VPN 并再次尝试对我有用。

Any typo inside the .firebaserc would show this error. .firebaserc中的任何错字都会显示此错误。 For me I had an extra comma, removing it solved the error.对我来说,我有一个额外的逗号,删除它解决了错误。

If none of the other answers worked for you, I had the same problem and received this solution from Firebase Support.如果其他答案都不适合您,我遇到了同样的问题,并从 Firebase 支持收到了这个解决方案。 (ty Sergei) (蒂谢尔盖)

My system will occasionally create and Environment Variable named FIREBASE_TOKEN.我的系统偶尔会创建名为 FIREBASE_TOKEN 的环境变量。 The token will expire, but the variable does not.令牌将过期,但变量不会。 Restarts and logout/login cycles did nothing.重新启动和注销/登录周期什么也没做。 Deleting the variable works every time though.每次删除变量都有效。

Remove-Item Env:\FIREBASE_TOKEN

It's really awesome and confusing------>真是太棒了,令人困惑------>

just did these command ->刚刚做了这些命令->

> firebase logout
> 
> firebase login

if you use Mac or Linux, you can write this command export http_proxy=http://127.0.0.1:1087 to make sure your terminal uses the proxy, which is useful for me.如果您使用 Mac 或 Linux,您可以编写此命令 export http_proxy=http://127.0.0.1:1087 以确保您的终端使用代理,这对我很有用。

None of the above solutions worked for me but removing/editing the stored value of the default project in $HOME/.config/configstore/firebase-tools.json did work.上述解决方案均不适合我,但删除/编辑$HOME/.config/configstore/firebase-tools.json中默认项目的存储值确实有效。

Make sure that you don't have this file .firebaserc already existing in your project directory if you already do!如果你已经存在,请确保你的项目目录中没有这个文件.firebaserc

Delete it and try firebase init in console again.删除它并再次在控制台中尝试firebase init

If you have this issue in a CI pipeline, you can regenerate a token on your local machine with如果您在 CI 管道中遇到此问题,您可以使用以下命令在本地计算机上重新生成令牌

firebase login:ci

Put the generated token as an environment variable, eg FIREBASE_TOKEN and run like this:将生成的令牌作为环境变量,例如FIREBASE_TOKEN并像这样运行:

firebase deploy --token "$FIREBASE_TOKEN"

For me, I was setting up a new machine with an existing firebase project.对我来说,我正在使用现有的 firebase 项目设置一台新机器。 This is what I did:这就是我所做的:

First successfully login to firebase from your command console首先从您的命令控制台成功登录到 firebase

firebase login

Get a list of your projects获取您的项目列表

firebase projects:list

Tell firebase which project you are using告诉 firebase 你正在使用哪个项目

firebase use <Project ID>

Then, I was able to deploy and use other commands for this project.然后,我能够为这个项目部署和使用其他命令。 Hope this helps someone.希望这可以帮助某人。

1.run this firebase logout firebase login 2.if u can not login successfully, like this? 1.run this firebase logout firebase login 2.如果你不能登录成功,像这样? [https://i.stack.imgur.com/4MJM5.png][1] [https://i.stack.imgur.com/4MJM5.png][1]

  1. run this, export http_proxy=http://localhost:your proxy port 4.successfully:.. [https.//i.stack.imgur.com/sRcvG.png][1]运行这个, export http_proxy=http://localhost:your proxy port 4.successfully:.. [https.//i.stack.imgur.com/sRcvG.png][1]

It is possible you are trying to deploy without internet connection.您可能正在尝试在没有 Internet 连接的情况下进行部署。 The first thing to look for is if your internet is okay.首先要寻找的是您的互联网是否正常。

I got this error in Linux when I was out of disk space, freeing some space resolved it.当我的磁盘空间不足时,我在 Linux 中收到此错误,释放一些空间解决了它。

暂无
暂无

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

相关问题 Azure 管道错误:无法获取 Firebase 项目项目名称。 请确保该项目存在并且您的帐户有权访问它 - Azure Pipline Error: Failed to get Firebase project project-name. Please make sure the project exists and your account has permission to access it 无法获取 Firebase 项目 xxxxxx。 请确保该项目存在并且您的帐户有权访问它 - Failed to get Firebase project xxxxxx. Please make sure the project exists and your account has permission to access it 错误:无法获取 Firebase 项目构建。 请确保该项目存在并且您的帐户有权访问它 - Error: Failed to get Firebase project build. Please make sure the project exists and your account has permission to access it firebase init throws Error: failed to get Firebase 项目名称错误 - firebase init throws Error: failed to get Firebase project with wrong project name CircleCI Workflow 找不到 Firebase 项目:项目选择无效,请验证项目“项目”是否存在并且您有权访问 - CircleCI Workflow cannot find Firebase project: Invalid project selection please verify project 'project' exists and you have access 您的访问已被 S3 拒绝,请确保您的请求凭据具有 awsserverlessrepo 的 GetObject 权限 - Your access has been denied by S3, please make sure your request credentials have permission to GetObject for awsserverlessrepo 如何解决“您的项目没有云服务机器人帐户。请确保为您的项目启用了 Dataflow API。” - How to fix "There is no cloudservices robot account for your project. Please ensure that the Dataflow API is enabled for your project." Firebase ID 令牌的受众 (aud) 声明不正确。 预期 确保 ID 令牌来自与 Firebase 相同的项目 - Firebase ID token has incorrect audience (aud) claim. Expected Make sure the ID token comes from the same Firebase project as the 使用云构建部署云功能失败:错误:未能获得 firebase 项目 - deploy cloud functions using cloud build failed: Error: failed to get firebase project Firebase 登录时出现“Auth.network-request-failed”错误的项目结果 - Firebase Project Results in "Auth/network-request-failed" error on login
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM