无法从 Sonatype Nexus 私有存储库安装 npm 软件包

问题描述 投票:0回答:2

我使用 Sonatype nexus 作为我的存储库,我已将 npm 配置为具有公共和私有存储库。

  • npm-public -> npm 注册表的代理。
  • npm-private -> 私有存储库,用于发布公司相关存储库。
  • npm-group -> 有权访问上述两个存储库的组。

我的 .npmrc 文件有配置

registry=<<private_repo_url>>/npm-group/
_auth=<<token>>
strict-ssl=false
always-auth=true

在本地计算机上安装私有包时出现以下错误

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

npm ERR! A complete log of this run can be found in:

虽然我可以将我的私有包发布到 <>/npm-internal/

我在

windows
笔记本电脑上使用
git bash
。 Sonatype Nexus 版本:
3.15.2
Node.js:
v12.21.0
npm:
6.14.11

如有任何帮助,我们将不胜感激。

node.js sonatype nexus3
2个回答
4
投票

尝试将

npm Bearer Token Realm
添加到您的安全配置中


0
投票

我在 docker 上也遇到了同样的问题。当我想将图像上传到 Nexus 时,出现 401 错误。我修改 Realms 后,解决了我的问题。感谢您的帮助。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.