我尝试运行以下命令:
npm install -g @angular/cli@9.1.0但我得到了以下错误:
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="Artifactory Realm"
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xxxx/.npm/_logs/2021-08-10T19_33_12_063Z-debug.log注意: node js和npm运行良好。
我已经按照Artifactory中的说明使用以下命令解决了这个问题:
npm config set registry https://artifactory.......com/artifactory/api/npm/xxxx/因为我已经将以下内容粘贴到~/.npmrc文件中:
_auth = fhgf......ghgj==
email = xxx@xxx.com
always-auth = true我也尝试过使用npm login,但遇到了以下错误,无法继续:
npm login
Username: xxx@xxx.com
npm WARN Name may not contain non-url-safe chars
Username: (xxx@xxx.com)
Username: (xxx@xxx.com)
Username: (xxx@xxx.com)
Username: (xxx@xxx.com)我该如何解决这个问题?
发布于 2021-12-17 17:15:52
更新12月,2021年
Artifactory移动到只支持APIKEY。如果您的旧_auth是username:password或username:encrypted_password的base64编码,那么现在两者都是不可接受的。您必须使用APIKEY来代替它们。
因此,支持的_auth现在变成:
_auth: APIKEY
但具有讽刺意味的是,即使这样在某些情况下也不起作用。
以下内容似乎更可靠:
中运行以下命令来获取base64
[System.Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("username:APIKEY"))
因此,最终的文件如下所示:
registry=<URL>
_auth = <Base64 of username:APIKEY>
email = myemail@email.com
always-auth = true发布于 2021-08-12 06:23:16
该问题是由于用户名中的“@”特殊字符造成的,我假设用户是基于SAML的。请按照以下步骤解决此问题。
”。
_auth =从第一点生成的auth-令牌始终-auth=真
发布于 2021-09-30 21:42:55
对我来说,问题是在Dockerfile文件中调用USER myusername太早了,即使.npmrc文件已经存在,它也会导致我的artifactory出现身份验证问题。
在npm i为我解决了这个问题之后,只需将用户呼叫下移即可。
https://stackoverflow.com/questions/68732744
复制相似问题