npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

npm audit failure message is too generic

Improve the output to include the response status code and message, and/or the response body/message; e.g.
503 No backends available
No frontdoor hosts available


What I Wanted to Do

$ npm audit -fix
                                                                                
                       === npm audit security report ===                        
                                                                                
found 0 vulnerabilities
 in 11739 scanned packages

What Happened Instead

$ npm audit -fix
npm ERR! code ENOAUDIT
npm ERR! audit Your configured registry (https://registry.npmjs.org/) does not support audit requests, or the audit endpoint is temporarily unavailable.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nmschulte/.npm/_logs/2019-06-12T18_17_00_784Z-debug.log

Reproduction Steps

npm audit -fix

Details

nmschulte@desmas-l:guardian/guardian/client$ diff /tmp/audit.js /home/nmschulte/.local/lib/node_modules/npm/lib/audit.js
200a201
>       console.log(err);
npm info it worked if it ends with ok
npm verb cli [ '/home/nmschulte/.local/bin/node',
npm verb cli   '/home/nmschulte/.local/bin/npm',
npm verb cli   'audit',
npm verb cli   '--verbose' ]
npm info using npm@6.9.0
npm info using node@v10.15.1
npm verb npm-session fba3cbd69428ee1e
npm http fetch POST 503 https://registry.npmjs.org/-/npm/v1/security/audits 13373ms
{ Error: 503 No backends available - POST https://registry.npmjs.org/-/npm/v1/security/audits
    at res.buffer.catch.then.body (/home/nmschulte/.local/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:104:15)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  headers:
   [Object: null prototype] {
     date: [ 'Wed, 12 Jun 2019 18:13:34 GMT' ],
     'content-type': [ 'application/json' ],
     'content-length': [ '42' ],
     connection: [ 'keep-alive' ],
     'set-cookie':
      [ '__cfduid=d09dbc50a3d4d7ae3c6c6ec21327a5fdf1560363200; expires=Thu, 11-Jun-20 18:13:20 GMT; path=/; domain=.npmjs.org; HttpOnly' ],
     'expect-ct':
      [ 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"' ],
     vary: [ 'Accept-Encoding' ],
     server: [ 'cloudflare' ],
     'cf-ray': [ '4e5dcc55cbe72523-ORD' ],
     'x-fetch-attempts': [ '1' ] },
  statusCode: 503,
  code: 'E503',
  method: 'POST',
  uri: 'https://registry.npmjs.org/-/npm/v1/security/audits',
  body: { message: 'No frontdoor hosts available' },
  pkgid: undefined,
  message:
   '503 No backends available - POST https://registry.npmjs.org/-/npm/v1/security/audits' }
npm verb stack Error: Your configured registry (https://registry.npmjs.org/) does not support audit requests, or the audit endpoint is temporarily unavailable.
npm verb stack     at Bluebird.all.spread.then.catch (/home/nmschulte/.local/lib/node_modules/npm/lib/audit.js:202:18)
npm verb stack     at tryCatcher (/home/nmschulte/.local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
npm verb stack     at Promise._settlePromiseFromHandler (/home/nmschulte/.local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
npm verb stack     at Promise._settlePromise (/home/nmschulte/.local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
npm verb stack     at Promise._settlePromise0 (/home/nmschulte/.local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
npm verb stack     at Promise._settlePromises (/home/nmschulte/.local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:690:18)
npm verb stack     at _drainQueueStep (/home/nmschulte/.local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:138:12)
npm verb stack     at _drainQueue (/home/nmschulte/.local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:131:9)
npm verb stack     at Async._drainQueues (/home/nmschulte/.local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:147:5)
npm verb stack     at Immediate.Async.drainQueues [as _onImmediate] (/home/nmschulte/.local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
npm verb stack     at runCallback (timers.js:705:18)
npm verb stack     at tryOnImmediate (timers.js:676:5)
npm verb stack     at processImmediate (timers.js:658:5)
npm verb cwd /home/nmschulte/projects/aviture/guardian/guardian/client
npm verb Linux 4.19.0-5-amd64
npm verb argv "/home/nmschulte/.local/bin/node" "/home/nmschulte/.local/bin/npm" "audit" "--verbose"
npm verb node v10.15.1
npm verb npm  v6.9.0
npm ERR! code ENOAUDIT
npm ERR! audit Your configured registry (https://registry.npmjs.org/) does not support audit requests, or the audit endpoint is temporarily unavailable.
npm verb exit [ 1, true ]
npm timing npm Completed in 14069ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/nmschulte/.npm/_logs/2019-06-12T18_13_34_180Z-debug.log

Platform Info

$ npm --versions
{ npm: '6.9.0',
  ares: '1.15.0',
  cldr: '33.1',
  http_parser: '2.8.0',
  icu: '62.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.34.0',
  node: '10.15.1',
  openssl: '1.1.0j',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.23.2',
  v8: '6.8.275.32-node.12',
  zlib: '1.2.11' }
$ node -p process.platform
linux