npm audit 返回 400 错误请求。

3
当我运行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,我的node版本是v14.16.0。

只要我这样做

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

它起作用了

有什么想法为什么会发生这种情况?


你找到这个问题的根本原因了吗?谢谢。 - undefined
1
@CharlesMorin 是的,请在使用审计时设置 --registry=https://registry.npmjs.org。这是我能让它正常工作的最佳方式。 - undefined
1个回答

3

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

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


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接