27

这是我得到的错误:

npm ERR! code ENOAUDIT
npm ERR! audit Your configured registry (https://registry.npmjs.org/) does not support audit requests.

使用日志文件:

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 ]

我尝试了在 github 上找到的多个想法,但我没有任何想法proxyhttp-proxy设置。两者都返回null

npm config get proxy
npm config get https-proxy

有任何想法吗?这不是暂时的,我已经有一段时间了。我觉得很奇怪503。这意味着我的连接有问题。

4

9 回答 9

11

尝试运行npm update,然后npm audit. 这应该可以解决问题。

于 2019-12-26T21:20:30.470 回答
9

package.json当你有类似的东西时,你可以拥有它"PACKAGE_NAME": "github:USERNAME/PACAKGE_NAME",或者任何其他不同的模式而不是典型的模式,即"PACKAGE_NAME": "PACKAGE_VERSION"

于 2019-08-17T11:41:01.413 回答
3

第一的

npm install -g npm

然后

npm audit

可以解决你的问题

于 2019-06-18T19:47:20.007 回答
1

我已经尝试了所有提到的答案,但没有运气。 当我 两者都 node_modules删除时才对我有用,然后package-lock.json 我运行npm install然后npm audit fix它就起作用了

于 2021-02-06T13:01:21.543 回答
0

我发现在https://npm.community/t/your-configured-registry-https-registry-npmjs-org-does-not-support-audit-requests/3600/6给出的答案有效,其中没有一个以上答案有帮助:

删除你的 node_modules 文件夹,然后尝试运行 npm install --> npm update --> npm audit

于 2020-10-07T05:54:54.397 回答
0

对我来说,只有在删除package-lock.json并运行后npm update我才能运行npm audit.

于 2021-02-01T14:35:13.233 回答
0

我相信这是 NPM 服务器的服务问题。在 CI 和开发机器的所有项目中,我都遇到了同样的问题。所以不太可能是环境或package.json问题。

注意错误:

http 获取 POST 503 https://registry.npmjs.org/-/npm/v1/security/audits 13252ms

503 是服务器问题:

超文本传输​​协议 (HTTP) 503 Service Unavailable 服务器错误响应代码表示服务器尚未准备好处理请求。

常见原因是服务器因维护而停机或过载。此响应应用于临时条件,并且如果可能,Retry-After HTTP 标头应包含服务恢复的估计时间。

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503

只需等待一段时间以解决 NPM 服务中的任何问题即可为我修复它。我怀疑所有这些关于更新 npm、删除package-lock.json、删除的答案node_modules只会导致服务问题的解决延迟。

于 2021-05-20T13:20:24.087 回答
0

解决此问题的最安全方法是删除文件夹node_modulespackage-lock.json并运行npm install

于 2021-06-22T07:29:57.573 回答
0

对我来说,问题出在我的 npm 配置文件中,上述修复均无效。

执行以下操作解决了该问题。

  1. 如果 npmrc 不可用,请安装它
npm i npmrc -g
  1. 为公共 NPM 注册表创建配置文件
npmrc -c npm

npm 配置设置注册表https://registry.npmjs.com/

参考:https ://docs.open-registry.dev/known-issues-and-workarounds/

于 2021-11-10T10:32:06.007 回答