Lerna Boostrap因NPM ERR失败!代码E401

发布于 2025-02-11 07:42:57 字数 1427 浏览 1 评论 0原文

每当我在Jenkins上运行Lerna Bootstrap时,它的失败就会出错,但会通过本地机器传递。

npm ERR! code E401
npm ERR! Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"

package.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"
}

运行命令

npm i
npm run bootstrap

npm i-通过,但“ npm run bootstrap”失败。

我尝试了多个选项,例如

  1. .npmrc in .NPMRC添加了my-repo

    的凭据

    // my-repo-url:8081/nexus/repository/npm-repo/:_ password = ## base-64-64-base-64编码password ## // my-repo-url:8081/nexus/repository/npm-repo/:username = ## usernamr ##

  2. in .npmrc _auth = ## base-64-engoded-sonded-soded-username-username-andame-andame-andame-andame-andame-password## #

  3. 中添加中,添加或删除” - always-auth = true”& lerna.json

    中的“ npmclientargs”中的“ - 图片-SSL”

版本

  1. 节点v14.17.0
  2. npm 6.14.13

whenever i'm running Lerna bootstrap on Jenkins its fails with error, but passes on local machine.

npm ERR! code E401
npm ERR! Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"

Package.json on main folder

"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"
}

running commands

npm i
npm run bootstrap

npm i - passes but "npm run bootstrap" fails.

I've tried multiple options like

  1. in .npmrc added credentials for my-repo

    //my-repo-url:8081/nexus/repository/npm-repo/:_password=##base-64-encoded-password##
    //my-repo-url:8081/nexus/repository/npm-repo/:username=##usernamr##

  2. in added in .npmrc _auth=##base-64-encoded-username-and-password##

  3. added or removed "--always-auth=true" & "--strict-ssl" from "npmClientArgs" in lerna.json

Versions

  1. node v14.17.0
  2. npm 6.14.13

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

溺ぐ爱和你が 2025-02-18 07:42:57

选项#1

  1. 我解决了,在lerna.json->中添加“ _auth”。 npmclientargs.i
    从.NPMRC复制_auth值,并在“ npmclientargs”中添加,
  2. 您也可以生成authtoken并在此处使用它
  {
  “软件包”:[
    “软件包/*”
  ],,
  “ npmclientargs”:[
    “  -  -Strict-ssl = false”,
    “  -  always-auth = true”,
    “  -  _ auth = auth-key”
  ],,
  “版本”:“独立”
}
 

选项#2

  1. 在构建过程中,您可以在所有“ packages/*”中递归复制.npmrc

Option#1

  1. I resolved by, adding "_auth" in lerna.json -> npmClientArgs.I
    Copied _auth value from .npmrc and added in "npmClientArgs"
  2. You can also generate authToken and use it here
{
  "packages": [
    "packages/*"
  ],
  "npmClientArgs": [
    "--strict-ssl=false",
    "--always-auth=true",
    "--_auth=AUTH-KEY"
  ],
  "version": "independent"
}

Option#2

  1. During build, you can recursively copy .npmrc in all "packages/*" folder
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文