`npm audit` 不断返回 "Your configured registry (https://registry.npmjs.org/) does not support audit requests."。我如何让它再次工作?
`npm audit` keeps returning "Your configured registry (https://registry.npmjs.org/) does not support audit requests.". How do I make it work again?
这是我得到的错误:
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 中找到的多个想法,但我没有任何 proxy
或 http-proxy
集。这两个 return null
:
npm config get proxy
npm config get https-proxy
有什么想法吗?这不是暂时的,我已经有一段时间了。我觉得我得到 503
很奇怪。这意味着我的连接有问题。
首先
npm install -g npm
然后
npm audit
可能会解决您的问题
当您的 package.json
中有类似 "PACKAGE_NAME": "github:USERNAME/PACAKGE_NAME"
的内容或任何其他不同的模式而不是典型模式时,您可能会拥有它,即 "PACKAGE_NAME": "PACKAGE_VERSION"
.
尝试 运行 npm update
然后 npm audit
。这应该可以解决问题。
我发现 https://npm.community/t/your-configured-registry-https-registry-npmjs-org-does-not-support-audit-requests/3600/6 给出的答案有效,其中 none 以上答案有帮助:
delete your node_modules folder then try running npm install --> npm update --> npm audit
对我来说,只有在删除 package-lock.json
和 运行ning npm update
之后,我才能 运行 npm audit
.
我已经尝试了所有提到的答案,但没有成功。
它只对我有用当我删除两者node_modules
和package-lock.json
在那之后我 运行 npm install
然后 npm audit fix
然后它工作
我确信这是 NPM 服务器的服务问题。我在 CI 和开发机器的所有项目中都遇到了同样的问题。所以不太可能是环境或 package.json
问题。
注意错误:
http fetch POST 503 https://registry.npmjs.org/-/npm/v1/security/audits 13252ms
503 是服务器问题:
The HyperText Transfer Protocol (HTTP) 503 Service Unavailable server error response code indicates that the server is not ready to handle the request.
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.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503
只需等待一些时间,让 NPM 服务中的任何问题得到解决,就可以为我解决问题。我怀疑所有这些关于更新 npm、删除 package-lock.json
、删除 node_modules
的答案只会导致延迟解决服务问题。
解决此问题最安全的方法是删除文件夹 node_modules 和 package-lock.json 和 运行npm install
对我来说,问题出在我的 npm 配置文件中,none 上述修复程序有效。
执行以下操作解决了问题。
- 如果 npmrc 尚不可用,请安装它
npm i npmrc -g
- 为 public NPM 注册表创建配置文件
npmrc -c npm
npm 配置设置注册表 https://registry.npmjs.com/
参考:https://docs.open-registry.dev/known-issues-and-workarounds/
这是我得到的错误:
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 中找到的多个想法,但我没有任何 proxy
或 http-proxy
集。这两个 return null
:
npm config get proxy
npm config get https-proxy
有什么想法吗?这不是暂时的,我已经有一段时间了。我觉得我得到 503
很奇怪。这意味着我的连接有问题。
首先
npm install -g npm
然后
npm audit
可能会解决您的问题
当您的 package.json
中有类似 "PACKAGE_NAME": "github:USERNAME/PACAKGE_NAME"
的内容或任何其他不同的模式而不是典型模式时,您可能会拥有它,即 "PACKAGE_NAME": "PACKAGE_VERSION"
.
尝试 运行 npm update
然后 npm audit
。这应该可以解决问题。
我发现 https://npm.community/t/your-configured-registry-https-registry-npmjs-org-does-not-support-audit-requests/3600/6 给出的答案有效,其中 none 以上答案有帮助:
delete your node_modules folder then try running npm install --> npm update --> npm audit
对我来说,只有在删除 package-lock.json
和 运行ning npm update
之后,我才能 运行 npm audit
.
我已经尝试了所有提到的答案,但没有成功。
它只对我有用当我删除两者node_modules
和package-lock.json
在那之后我 运行 npm install
然后 npm audit fix
然后它工作
我确信这是 NPM 服务器的服务问题。我在 CI 和开发机器的所有项目中都遇到了同样的问题。所以不太可能是环境或 package.json
问题。
注意错误:
http fetch POST 503 https://registry.npmjs.org/-/npm/v1/security/audits 13252ms
503 是服务器问题:
The HyperText Transfer Protocol (HTTP) 503 Service Unavailable server error response code indicates that the server is not ready to handle the request.
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.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503
只需等待一些时间,让 NPM 服务中的任何问题得到解决,就可以为我解决问题。我怀疑所有这些关于更新 npm、删除 package-lock.json
、删除 node_modules
的答案只会导致延迟解决服务问题。
解决此问题最安全的方法是删除文件夹 node_modules 和 package-lock.json 和 运行npm install
对我来说,问题出在我的 npm 配置文件中,none 上述修复程序有效。
执行以下操作解决了问题。
- 如果 npmrc 尚不可用,请安装它
npm i npmrc -g
- 为 public NPM 注册表创建配置文件
npmrc -c npm
npm 配置设置注册表 https://registry.npmjs.com/
参考:https://docs.open-registry.dev/known-issues-and-workarounds/