[英]`npm audit` keeps returning "Your configured registry (https://registry.npmjs.org/) does not support audit requests.". How do I make it work again?
Here is the error I get:这是我得到的错误:
npm ERR! code ENOAUDIT
npm ERR! audit Your configured registry (https://registry.npmjs.org/) does not support audit requests.
with the log file:使用日志文件:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'audit' ]
2 info using npm@6.4.1
3 info using node@v10.12.0
4 verbose npm-session 65e7a3436fc1253b
5 timing audit compress Completed in 25ms
6 info audit Submitting payload of 217372 bytes
7 http fetch POST 503 https://registry.npmjs.org/-/npm/v1/security/audits 13252ms
8 verbose stack Error: Your configured registry (https://registry.npmjs.org/) does not support audit requests.
8 verbose stack at Bluebird.all.spread.then.catch (/usr/local/lib/node_modules/npm/lib/audit.js:172:18)
8 verbose stack at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
8 verbose stack at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
8 verbose stack at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
8 verbose stack at Promise._settlePromise0 (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
8 verbose stack at Promise._settlePromises (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:689:18)
8 verbose stack at Async._drainQueue (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16)
8 verbose stack at Async._drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
8 verbose stack at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
8 verbose stack at runCallback (timers.js:705:18)
8 verbose stack at tryOnImmediate (timers.js:676:5)
8 verbose stack at processImmediate (timers.js:658:5)
9 verbose cwd /Users/danielhasegan/workspace/code
10 verbose Darwin 18.2.0
11 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "audit"
12 verbose node v10.12.0
13 verbose npm v6.4.1
14 error code ENOAUDIT
15 error audit Your configured registry (https://registry.npmjs.org/) does not support audit requests.
16 verbose exit [ 1, true ]
I tried multiple ideas found across github but I do not have any proxy
or http-proxy
set.我尝试了在 github 中找到的多个想法,但我没有设置任何proxy
或http-proxy
。 both of those return null
:两者都返回null
:
npm config get proxy
npm config get https-proxy
Any ideas?有任何想法吗? This is not transitory, ive been getting it for a while now.这不是暂时的,我已经有一段时间了。 I find it weird I get 503
.我觉得我得到503
很奇怪。 It means something is wrong with my connection.这意味着我的连接有问题。
Try running npm update
and then npm audit
.尝试运行npm update
然后npm audit
。 This should fix the problem.这应该可以解决问题。
当你的package.json
有类似"PACKAGE_NAME": "github:USERNAME/PACAKGE_NAME"
或任何其他不同的模式而不是典型的模式时,你可以拥有它,即"PACKAGE_NAME": "PACKAGE_VERSION"
。
First第一的
npm install -g npm
then然后
npm audit
may solve your problem可能会解决您的问题
i have tried all the answers mentioned but no luck.我已经尝试了所有提到的答案,但没有运气。 it works for me only when i removed both node_modules
and package-lock.json
after that i run npm install
and then npm audit fix
then it worked它的工作对我来说,只有当我删除这两个node_modules
和package-lock.json
,我运行后npm install
,然后npm audit fix
,然后它的工作
I found that the answer given at https://npm.community/t/your-configured-registry-https-registry-npmjs-org-does-not-support-audit-requests/3600/6 worked, where none of the above answers helped:我发现https://npm.community/t/your-configured-registry-https-registry-npmjs-org-does-not-support-audit-requests/3600/6给出的答案有效,其中没有以上答案有帮助:
delete your node_modules folder then try running npm install --> npm update --> npm audit删除您的 node_modules 文件夹,然后尝试运行 npm install --> npm update --> npm audit
对我来说,只有在删除package-lock.json
并运行npm update
我才能运行npm audit
。
I'm confident this is a service issue with the NPM servers.我相信这是 NPM 服务器的服务问题。 I got this same issue, across all projects, in CI and development machines.我在 CI 和开发机器中的所有项目中都遇到了同样的问题。 So unlikely to be environment or package.json
issues.所以不太可能是环境或package.json
问题。
Notice the error:注意错误:
http fetch POST 503 https://registry.npmjs.org/-/npm/v1/security/audits 13252ms http 获取 POST 503 https://registry.npmjs.org/-/npm/v1/security/audits 13252ms
A 503 is a server issue: 503 是服务器问题:
The HyperText Transfer Protocol (HTTP) 503 Service Unavailable server error response code indicates that the server is not ready to handle the request.超文本传输协议 (HTTP) 503 服务不可用服务器错误响应代码表示服务器未准备好处理请求。
Common causes are a server that is down for maintenance or that is overloaded.常见原因是服务器停机维护或过载。 This response should be used for temporary conditions and the Retry-After HTTP header should, if possible, contain the estimated time for the recovery of the service.此响应应用于临时条件,并且 Retry-After HTTP 标头应尽可能包含服务恢复的估计时间。
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503
Simply waiting some time for whatever issue in the NPM service to be resolved fixed it for me.只需等待一些时间来解决 NPM 服务中的任何问题即可为我修复它。 I suspect all these answers about updating npm, removing package-lock.json
, deleting node_modules
simply cause a delay for the service issues to resolve.我怀疑所有这些关于更新 npm、删除package-lock.json
、删除node_modules
只会导致服务问题解决的延迟。
解决此问题的最安全方法是删除文件夹node_modules和package-lock.json并运行npm install
For me problem was in my npm profile and none of the above mentioned fixes worked.对我而言,问题出在我的 npm 配置文件中,上述修复程序均无效。
Doing the following fixed the issue.执行以下操作解决了该问题。
1: Install npmrc if it's not already available 1: 如果 npmrc 不可用,请安装它
npm i npmrc -g npm i npmrc -g
2: Create a profile for the public NPM registry 2:为公共 NPM 注册表创建配置文件
npmrc -c npm npmrc -c npm
npm config set registry https://registry.npmjs.com/ npm 配置设置注册表https://registry.npmjs.com/
Reference : https://docs.open-registry.dev/known-issues-and-workarounds/参考: https : //docs.open-registry.dev/known-issues-and-workarounds/
We have a private registry mentioned in the .npmrc
file that was preventing the audit.我们在.npmrc
文件中提到了一个阻止审计的私有注册表。 I just commented that out to run the audit.我只是评论说要进行审计。
I would not recommend npm update
, especially on enterprise applications like mine, that have hundreds of modules and tens of internal and external dependencies.我不会推荐npm update
,尤其是像我这样的企业应用程序,它有数百个模块和数十个内部和外部依赖项。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.