为企业注册表启用审计命令npm

Ani*_*r R 10 javascript node.js npm

我的问题是关于如何在我的npm企业注册表中启用npm audit命令

当我尝试运行npm审计命令时,我收到以下错误

{
  "error": {
    "code": "ENOAUDIT",
    "summary": "Your configured registry (https://registry.npmjs.mydomain/) does not support audit requests.",
    "detail": ""
  }
}
Run Code Online (Sandbox Code Playgroud)

这是我的研究

我尝试使用以下命令及其工作

npm audit --json --registry https://registry.npmjs.org/
Run Code Online (Sandbox Code Playgroud)

但是当我使用时

npm audit --json --registry https://registry.npmjs.mydomain/
Run Code Online (Sandbox Code Playgroud)

这是行不通的.如何配置以使我的注册表与npm audit命令一起使用

Iho*_*hor 11

我也有同样的问题.我们正在使用神秘的npm注册表,它不支持npm审计.最适合我的解决方案是:

npm audit --registry=https://registry.npmjs.org

替代方案:

  1. 私有注册表的备份配置文件(很可能是〜/ .npmrc)
  2. 更改公共npm上的注册表: npm set registry https://registry.npmjs.org
  3. 使用npm audit/npm audit fix
  4. 恢复私有注册表配置