简体   繁体   English

E401 - 无法验证,您的验证令牌似乎无效

[英]E401 - Unable to authenticate, your authentication token seems to be invalid

I tested with Azure Packages private NPM server and now want to revert back to using the standard NPM registry but when I do it complains.我使用 Azure Packages 私有 NPM 服务器进行了测试,现在想恢复使用标准 NPM 注册表,但是当我这样做时会抱怨。 I have tried everything I can think of and it is blocking me from doing any work now.我已经尝试了我能想到的一切,它现在阻止我做任何工作。 I'd really appreciate any help.我真的很感激任何帮助。

The error错误

  • npm ERR! npm 错误! code E401代码 E401
  • npm ERR, Unable to authenticate. npm ERR,无法验证。 your authentication token seems to be invalid.您的身份验证令牌似乎无效。
  • npm ERR: To correct this please trying logging in again with: npm ERR:要更正此问题,请尝试再次登录:
  • npm ERR! npm 错误! npm login npm登录

If I check the log it is still, somehow, trying to find packages from Azure rather than the npm registry.如果我检查日志,它仍然以某种方式试图从 Azure 而不是 npm 注册表中查找包。

The Azure URL specified below doesnt exist in any.npmrc file or package-lock file I can find!下面指定的 Azure URL 在我能找到的任何.npmrc 文件或包锁定文件中都不存在!

To be clear here I want to use the default NPM registry not Azure.在这里要清楚,我想使用默认的 NPM 注册表而不是 Azure。 eg例如

32 silly fetch manifest @types/angular@https://pkgs.dev.azure.com/***/***/_packaging/***.Common.UI/npm/registry/@types/angular/-/angular-1.6.45.tgz

Steps I have taken我已采取的步骤

In each case, running npm install still gives me the same error.在每种情况下,运行npm install仍然给我同样的错误。

Please help!请帮忙!

Check your package.json for the node version you should be using and make sure that you are using a compatible version with nvm or something.检查您的 package.json 以获取您应该使用的节点版本,并确保您使用的是与 nvm 或其他东西兼容的版本。 This has been consistently the reason I have seen this error lately on my own machine.这一直是我最近在自己的机器上看到此错误的原因。

.npmrc containing private repo credentials .npmrc 包含私有 repo 凭证

  • I had similar error.我有类似的错误。 It turned out that I've saved some credentials for private repo on.npmrc file at the root of my home folder.事实证明,我已经在我的主文件夹的根目录中保存了一些私有 repo on.npmrc 文件的凭据。
  • So when I did npm install on my project, I get package-lock.json file contents appended with the private repo url.因此,当我在我的项目上安装 npm 时,我得到了 package-lock.json 文件内容,附加了私人仓库 url。 So this was the source of the error when deploying the project.所以这是部署项目时错误的根源。
  • What I did was to temporarily remove the.npmrc, delete package-lock.json, delete node_modules and re-run npm install.我所做的是暂时删除.npmrc,删除package-lock.json,删除node_modules并重新运行npm安装。
  • In my case the private repo details was not relevant for the project(so deleting.npmrc was not an issue)就我而言,私人回购详细信息与项目无关(因此删除.npmrc 不是问题)

Had similar issue, Deleting the.npmrc and then doing npm login again solved my issue, it was located in the project directory有类似的问题,删除.npmrc然后做npm登录再次解决了我的问题,它位于项目目录

Here I found very useful Microsoft documentation to get rid of this issue在这里我找到了非常有用的微软文档来摆脱这个问题

Please refer to "Unable to authenticate" section https://docs.microsoft.com/en-us/azure/devops/artifacts/npm/npmrc?view=azure-devops&tabs=windows%2Cclassic请参阅“无法验证”部分https://docs.microsoft.com/en-us/azure/devops/artifacts/npm/npmrc?view=azure-devops&tabs=windows%2Cclassic

The credentials in the.npmrc file have an expiration time. .npmrc 文件中的凭据具有过期时间。 You need regenerate these credentials.您需要重新生成这些凭据。

暂无
暂无

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

相关问题 Npm 无法进行身份验证,您的身份验证令牌似乎无效 - Npm unable to authenticate, your authentication token seems to be invalid NPM ERR代码E401:无法认证,需要:承载授权 - NPM ERR Code E401: Unable to authenticate, need: Bearer authorization npm 错误 E401:无法验证,需要:BASIC realm="Sonatype Nexus Repository Manager" - npm error E401: Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager" 尝试连接到 Azure DevOps 工件时“无法验证”通过 npm 馈送; 我收到 E401 错误 - 'Unable to Authenticate' when trying to connect to Azure DevOps Artifacts feed through npm; I get an E401 error Lerna boostrap 因 npm ERR 而失败! 代码 E401 - Lerna boostrap fails with npm ERR! code E401 运行“npm install”会导致“npm ERR! 代码 E401' - Running 'npm install' causes a 'npm ERR! code E401' npm 错误,代码 E401,密码错误或丢失 - npm Err! code E401, Incorrect or missing password 错误! 代码 E401 npm 错误! 密码不正确或丢失 - npm ERR! code E401 npm ERR! Incorrect or missing password HTTP 错误:401,请求的身份验证凭据无效。 预期的 OAuth 2 访问令牌、登录 cookie 或其他有效的身份验证凭据 - HTTP Error: 401, Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential Jwt 令牌身份验证无效令牌与 Nodejs - Jwt token authentication Invalid token with Nodejs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM