【问题标题】:npm audit return 400 Bad Requestnpm 审核返回 400 错误请求
【发布时间】:2022-04-04 21:23:56
【问题描述】:

当我运行 npm audit 我得到

npm audit
npm ERR! code ENOAUDIT
npm ERR! audit Your configured registry (http://registry.npmjs.org/) may not support audit requests, or the audit endpoint may be temporarily unavailable.
npm ERR! audit The server said: <html>
npm ERR! audit <head><title>400 Bad Request</title></head>
npm ERR! audit <body>
npm ERR! audit <center><h1>400 Bad Request</h1></center>
npm ERR! audit <hr><center>cloudflare</center>
npm ERR! audit </body>
npm ERR! audit </html>
npm ERR! audit

我尝试了以下方法

delete pack lock
npm update
npm i

但它仍在发生 我的 npm 版本是 6.14.11,我的节点版本是 v14.16.0

只要我这样做

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

有效

知道为什么会这样吗?

【问题讨论】:

  • 你找到这个的根本原因了吗?谢谢
  • @CharlesMorin 是的,请在使用审计时设置 --registry=registry.npmjs.org。这是我可以让它工作的最好方法

标签: npm npm-install npm-audit


【解决方案1】:

命令行提示你应该从现在开始使用 https

npm audit --audit-level=high --package-lock-only=true --registry=https://registry.npmjs.org

【讨论】:

    猜你喜欢
    • 2019-07-28
    • 2019-07-11
    • 2015-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多