每当我在Jenkins上运行Lerna bootstrap时,它就会出错,但会传递到本地机器上。
npm ERR! code E401
npm ERR! Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"
包。json在主文件夹
"scripts":{
"bootstrap": "lerna bootstrap --loglevel verbose",
"publish-packages": "lerna publish --skip-git",
"clean": "lerna clean"
},
"dependencies": {
"lerna": "^5.0.0"
}
lerna.json
{
"packages": [
"packages/*"
],
"npmClientArgs": [
"--strict-ssl=false",
"--always-auth=true"
],
"version": "independent"
}
<<p>运行命令/strong>npm i
npm run bootstrap
npm i - pass but "npm run bootstrap"失败。
我已经尝试了多个选项,如
在.npmrc中添加了my-repo的凭据
//my-repo-url: 8081/联系/仓库/npm-repo/: _password = # # # # base - 64编码-密码//my-repo-url: 8081//仓库/npm-repo/关系:用户名= # # usernamr # #
in added in .npmrc _auth=##base-64-encoded-username-and-password##
添加或删除"——always-auth=true","——strict-ssl"从"npmClientArgs"在lerna.json
版本
- 节点v14.17.0
- npm 6.14.13
选项#1
- 我通过添加"_auth"在lerna。json→npmClientArgs。我从.npmrc中复制_auth值,并添加"npmClientArgs">
- 你也可以生成authToken并在这里使用
{ "packages": [ "packages/*" ], "npmClientArgs": [ "--strict-ssl=false", "--always-auth=true", "--_auth=AUTH-KEY" ], "version": "independent" }
选项# 2
- 在构建过程中,您可以递归地将.npmrc复制到所有的包中/*";文件夹