npm 错误!无法进行身份验证,需要:Basic Realm="https://pkgsprodsu3weu.app.pkgs.visualstudio.com/"

fri*_*tz6 4 realm node.js npm

我运行 npm i @wtw/canvas 并收到此错误:

npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="https://pkgsprodsu3weu.app.pkgs.visualstudio.com/"
Run Code Online (Sandbox Code Playgroud)

我的.npmrc:

@willistowerswatson:registry=https://rcss-willistowerswatson.pkgs.visualstudio.com/_packaging/Core@Local/npm/registry/
registry=https://registry.npmjs.org/
//always-auth=true
//pkgs.dev.azure.com/rcss-willistowerswatson/RadarEnterprise/_packaging/RadarEnterprise/npm/registry/:username=VssSessionToken
Run Code Online (Sandbox Code Playgroud)

我已经尝试过:

vsts-npm-auth -config C:\Users\wilso224\.npmrc

vsts-npm-auth v0.41.0.0
-----------------------
Already have credentials for https://rcss-willistowerswatson.pkgs.visualstudio.com/_packaging/Core@Local/npm/registry/
Run Code Online (Sandbox Code Playgroud)

这也失败了:

npm i --registry https://registry.npmjs.org @wtw/canvas
Run Code Online (Sandbox Code Playgroud)

结果:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@wtw%2fcanvas - Not found
npm ERR! 404
npm ERR! 404  '@wtw/canvas@0.1.1' is not in the npm registry.
Run Code Online (Sandbox Code Playgroud)

我已经阅读了以下内容:

npm 错误!无法验证,需要:Basic Realm=“Artifactory Realm”

npm 令牌列表给出错误

https://learn.microsoft.com/en-gb/azure/devops/artifacts/npm/npmrc?view=azure-devops&tabs=windows%2Cclassic#set-up-authentication-on-your-dev-box

https://developercommunity.visualstudio.com/t/401-when-attempting-to-run-npm-install/928369

谢谢。

编辑#1 无论如何,我尝试了 npm 登录,它要求我设置一个新帐户等。我从事这项工作已有 3 年多了,我不记得每次遇到此类错误时都需要设置一个帐户。

小智 7

第一次运行:

vsts-npm-auth -config .npmrc -force
Run Code Online (Sandbox Code Playgroud)

进而:

npm i
Run Code Online (Sandbox Code Playgroud)