我尝试运行命令:
\nnpm install -g @angular/cli@9.1.0\nRun Code Online (Sandbox Code Playgroud)\n但我有以下错误:
\n\n\nnpm 错误!代码E401
\n
\nnpm 错误!无法验证,需要:Basic Realm=“Artifactory Realm”npm 错误!此运行的完整日志可以在以下位置找到:
\n
\nnpm ERR!/Users/xxxx/.npm/_logs/2021-08-10T19_33_12_063Z-debug.log
注意:node js 和 npm 工作正常。
\n我已按照 Artifactory 中的说明使用以下命令解决此问题:
\nnpm config set registry https://artifactory.......com/artifactory/api/npm/xxxx/\nRun Code Online (Sandbox Code Playgroud)\n因为我已将以下内容粘贴到 ~/.npmrc 文件中:
\n_auth = fhgf......ghgj==\nemail = xxx@xxx.com\nalways-auth = true\nRun Code Online (Sandbox Code Playgroud)\n我也尝试过使用npm login,但出现以下错误并且无法\xe2\x80\x99t 继续:
\n\nnpm 登录
\n
\n用户名:xxx@xxx.com
\nnpm 警告名称不能包含非 url 安全字符
\n用户名:(xxx@xxx.com)
\n用户名:(xxx@xxx.com)
\n用户名:(xxx@xxx .com)
\n用户名: (xxx@xxx.com)
我该如何解决这个问题?
\nkam*_*eet 30
Artifactory 改为仅支持 APIKEY。如果您的旧 _auth 是username:password或的 base64 编码username:encrypted_password,那么现在两者都是不可接受的。您必须使用 APIKEY 来代替这些。
因此,支持的 _auth 现在变为:
_auth:APIKEY
但讽刺的是,即使这样在某些情况下也不起作用。
以下似乎更可靠:
[System.Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("username:APIKEY"))
%userprofile%\.npmrc)因此,最终文件如下所示:
registry=<URL>
_auth = <Base64 of username:APIKEY>
email = myemail@email.com
always-auth = true
Run Code Online (Sandbox Code Playgroud)
小智 10
该问题是由于用户名中的“@”特殊字符造成的,我假设该用户是基于 SAML 的。请按照以下步骤解决该问题,
\n\n\n_auth = 从第一点生成的身份验证令牌
\n
\n\n始终验证 = true
\n
尝试这样的事情。
.npmrc 文件内容如下:
//npm.corp_id.com/:_authToken=TOKEN_VALUE_HERE
Run Code Online (Sandbox Code Playgroud)
从 .npmrc 中的 authToken 中删除_,这只是为了我
//npm.corp_id.com/:authToken=TOKEN_VALUE_HERE
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
118786 次 |
| 最近记录: |