29

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. both of those return 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. It means something is wrong with my connection.

Daniel Hasegan
  • 785
  • 1
  • 8
  • 15
  • Maybe [this](http://status.npmjs.org/incidents/vnmt8kf52bh4) is happening again? – P Varga Mar 02 '19 at 00:30
  • Are you in the Dublin region? There is an open incident on the status page, although symptoms are different than your issue: https://status.npmjs.org – shadowspawn Mar 02 '19 at 22:47
  • 1
    No, this is in San Francisco. I've been having it for weeks now. – Daniel Hasegan Mar 04 '19 at 19:25
  • I'm also encountering this issue. Anyone find a solution? I tried: npm remove nodemon npm install --save-dev nodemon npm audit fix Other have reported this fixing their issue. However this doesn't fix mine. – llamacorn May 30 '19 at 21:19
  • @llamacorn why do you think `nodemon` was the issue? Can you point to the place where people were talking about that? I am thinking that its either a weird package or the package-lock file is too large. – Daniel Hasegan Jun 04 '19 at 23:57
  • 1
    @DanielHasegan I tried a few things found. This is one of the resources I was using, however it did not solve my issue. https://npm.community/t/npm-audit-fails-with-enoaudit-on-500-response/3629/5 – llamacorn Jun 05 '19 at 20:59

10 Answers10

11

Try running npm update and then npm audit. This should fix the problem.

Sohail
  • 4,506
  • 2
  • 38
  • 42
10

You could have it when in your package.json you have something like "PACKAGE_NAME": "github:USERNAME/PACAKGE_NAME", or any other different pattern rather than the typical one, i.e. "PACKAGE_NAME": "PACKAGE_VERSION".

Daniel Danielecki
  • 8,508
  • 6
  • 68
  • 94
  • 1
    thats it dude! Thanks – Daniel Hasegan Aug 19 '19 at 18:15
  • Actually I think it fixed itself with a new version of NPM – Daniel Hasegan Aug 19 '19 at 18:22
  • 1
    I had the same problem with an invalid repository URL. The problem was solved after fixing the URL `"repository": { "type": "git", "url": "https://domain/path/repo.git" }` – Troglo Nov 22 '19 at 17:59
  • I have this issue trying to run the final version of this https://github.com/VelizarMihaylov/medium-keystone-react-cms, but there is not such patter in that, so I would assume this is really the issue – Carmine Tambascia Dec 15 '19 at 18:41
  • @DanielHasegan, have you unaccepted this answer after... 1+ year? :-| – Daniel Danielecki Oct 08 '20 at 07:24
  • i'm getting the same problem with the same reasoning when I revert from atypical to typical it does not error. I need to use the atypical as the original dependencies are no longer supported. – Don Jan 30 '22 at 13:20
3

First

npm install -g npm

then

npm audit

may solve your problem

Gökhan Ayhan
  • 1,184
  • 11
  • 12
2

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

korchix
  • 1,445
  • 1
  • 19
  • 22
  • I'm upvoting this because in my case, I got this same error due to a broken `package-lock.json` file, caused by a botched merge Renovate had made. The error message makes it sound like there's something wrong with the npm registry when the issue was on my end the whole time. – bmaupin Mar 22 '22 at 16:32
1

For me problem was in my npm profile and none of the above mentioned fixes worked.

Doing the following fixed the issue.

  1. Install npmrc if it's not already available
npm i npmrc -g
  1. Create a profile for the public NPM registry
npmrc -c npm

npm config set registry https://registry.npmjs.com/

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

Naeio
  • 1,112
  • 7
  • 21
vishal
  • 21
  • 5
0

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:

delete your node_modules folder then try running npm install --> npm update --> npm audit

Stephen Lead
  • 1,904
  • 5
  • 23
  • 46
  • Hi Stephen, any other ideas? I used those steps with no luck: delete the node_modules folder, npm install, npm update, npm audit. I get the error "socker hang up", "audit endpoint returned an error". It seems like I can do everything other than perform an audit on the latest version of npm. I'm wondering if this is somehow related to trying this in Windows Subsystem for Linux. It happens in Ubuntu and Debian. I can use wget successfully from to access websites. – Lazor Dec 08 '20 at 23:53
  • Sorry, no idea - I'm definitely not an expert in this area – Stephen Lead Dec 09 '20 at 01:19
0

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

Alenros
  • 816
  • 7
  • 23
0

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.

Joe
  • 6,773
  • 2
  • 47
  • 81
0

The safest way to fix this is remove folder node_modules and package-lock.json and run npm install

Bekti Galan
  • 81
  • 2
  • 8
0

We have a private registry mentioned in the .npmrc file that was preventing the audit. 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.

Sandeep Kumar
  • 2,397
  • 5
  • 30
  • 37