我目前正在try 建立一个Jenkins和一个私有npm存储库(Sonatype Nexus).

+ npm publish --registry https://<my-private-registry>/repository/npm-private/
npm notice 
npm notice package: ts-acoustics@0.0.0
npm notice === Tarball Contents === 
npm notice 2.4kB  Jenkinsfile                       
...
('notice' level info about the files)
...
npm notice === Tarball Details === 
npm notice name:          ts-acoustics                            
npm notice version:       0.0.0                                   
npm notice package size:  13.8 kB                                 
npm notice unpacked size: 47.5 kB                                 
npm notice shasum:        554b6d2b41321d78e00f6a309bb61c9181a2e3d6
npm notice integrity:     sha512-QtExdu6IqZ+lH[...]r+HXolo4YCFPg==
npm notice total files:   17                                      
npm notice 
npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://<my-private-registry>/repository/npm-private/ts-acoustics
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy.

我在Nexus日志(log)中找不到关于为什么它被禁止的更多信息,this open GitHub bug告诉我,在大多数情况下,上面的错误文本指向错误的方向?!

你知道如何继续让出版工作吗?!


Update 1: I just saw that I have the same problem when I try to publish it manually!所以jenkins 因为简单的原因被排除在等式之外.

Update 2:我能做npm adduser --registry...,npm告诉我

Logged in as <my-user> on https://<my-private-registry>/repository/npm-private/.

当我输入npm whoami --registry...时,它会显示正确的用户名.

当我在项目中执行npm publish --registry...时,它显示403错误

推荐答案

100

正如你从所有答案中所看到的,有很多事情会导致相同的失败信息.以下是如何找到根本原因:

In the Nexus Repository Manager -> menu entry "Logging"
There you can simply change the log level for each java package Nexus consists of at runtime.

更改包的所有日志(log)级别,包括"security"或"rest",以便再次跟踪和触发您的请求.

LogViewer页(也是Nexus的一部分)中,你有望看到现在理解问题所需的所有信息.


在我的例子中,我必须将nx-repository-view-*-*-edit特权添加到我为Jenkins用来登录Nexus的用户创建的角色中.我觉得nx-repository-view-*-*-add已经足够出版了.

希望有帮助!

Typescript相关问答推荐

如何传递基于TypScript中可变类型的类型?

如何推断哪个特定密钥与泛型匹配?

部分类型化非 struct 化对象参数

在分配给类型的只读变量中维护const的类型

如何在Vue中使用Enum作为传递属性的键类型?

从子类集合实例化类,同时保持对Typescript中静态成员的访问

我在Angular 17中的environment.ts文件中得到了一个属性端点错误

如何将对象数组中的键映射到另一种对象类型的键?

如何正确调用创建的类型?

自定义 Select 组件的类型问题:使用带逗号的泛型类型<;T与不带逗号的<;T&>;时出错

避免混淆两种不同的ID类型

在Cypress中,您能找到表格中具有特定文本的第一行吗?

TypeScrip-根据一个参数值验证另一个参数值

对于VUE3,错误XX不存在于从不存在的类型上意味着什么?

如何为带有参数的函数类型指定类型保护?

基于区分的联合键的回调参数缩小

如何键入';v型';

在ts中获取级联子K类型?

带动态键的 TS 功能

元组解释