`npm audit` продолжает возвращаться" Ваш настроенный реестр (https://registry.npmjs.org/) не поддерживает запросы на аудит." Как мне заставить это работать снова?

Вот ошибка, которую я получаю:

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 задавать. оба возвращаются null:

npm config get proxy
npm config get https-proxy

Есть идеи? Это не преходящее, я получаю это некоторое время. Я нахожу это странным, я получаю 503, Это означает, что что-то не так с моей связью.

10 ответов

Попробуйте бежать npm update а потом npm audit. Это должно решить проблему.

Вы могли бы получить это, когда в вашем package.json у тебя есть что-то вроде "PACKAGE_NAME": "github:USERNAME/PACAKGE_NAME", или любой другой шаблон, а не типичный, т.е. "PACKAGE_NAME": "PACKAGE_VERSION".

Первый

npm install -g npm

тогда

npm audit

может решить вашу проблему

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

Для меня проблема была в моем профиле 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/

Я обнаружил, что ответ на 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

For me only after removing package-lock.json and running npm update I could run npm audit.

У нас есть частный реестр, упомянутый в.npmrcфайл, который мешал аудиту. Я просто прокомментировал это, чтобы запустить аудит.

я бы не рекомендовалnpm update, особенно в таких корпоративных приложениях, как мое, с сотнями модулей и десятками внутренних и внешних зависимостей.

I'm confident this is a service issue with the NPM servers. I got this same issue, across all projects, in CI and development machines. So unlikely to be environment or package.json issues.

Notice the error:

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

A 503 is a server issue:

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

Simply waiting some time for whatever issue in the NPM service to be resolved fixed it for me. 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.

Самый безопасный способ исправить это - удалить папку node_modules и package-lock.json и запустить npm install

Другие вопросы по тегам