Cannot run npm audit

cli
triaged

(Shaun) #1

What I Wanted to Do

I wanted to run npm audit to audit my dependencies.

What Happened Instead

I got an error:

0 info it worked if it ends with ok
1 verbose cli [ ‘/Users/shak/.nvm/versions/node/v8.11.4/bin/node’,
1 verbose cli ‘/Users/shak/.nvm/versions/node/v8.11.4/bin/npm’,
1 verbose cli ‘audit’,
1 verbose cli ‘fix’ ]
2 info using npm@6.4.0
3 info using node@v8.11.4
4 verbose npm-session 61f2f887a16425b8
5 timing audit compress Completed in 10ms
6 info audit Submitting payload of 54800 bytes
7 http fetch POST 400 https://registry.npmjs.org/-/npm/v1/security/audits 1308ms
8 verbose stack Error: 400 Bad Request - POST https://registry.npmjs.org/-/npm/v1/security/audits
8 verbose stack at res.buffer.catch.then.body (/Users/shak/.nvm/versions/node/v8.11.4/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:94:15)
8 verbose stack at
8 verbose stack at process._tickCallback (internal/process/next_tick.js:188:7)
8 verbose stack From previous event:
8 verbose stack at Gzip.onEnd (zlib.js:131:5)
8 verbose stack at emitNone (events.js:111:20)
8 verbose stack at Gzip.emit (events.js:208:7)
8 verbose stack at endReadableNT (_stream_readable.js:1064:12)
8 verbose stack at _combinedTickCallback (internal/process/next_tick.js:138:11)
8 verbose stack at process._tickCallback (internal/process/next_tick.js:180:9)
8 verbose stack From previous event:
8 verbose stack at Object.submitForFullReport (/Users/shak/.nvm/versions/node/v8.11.4/lib/node_modules/npm/lib/install/audit.js:70:42)
8 verbose stack at Bluebird.all.spread.then (/Users/shak/.nvm/versions/node/v8.11.4/lib/node_modules/npm/lib/audit.js:169:18)
8 verbose stack at runCallback (timers.js:810:20)
8 verbose stack at tryOnImmediate (timers.js:768:5)
8 verbose stack at processImmediate [as _immediateCallback] (timers.js:745:5)
8 verbose stack From previous event:
8 verbose stack at EventEmitter.auditCmd (/Users/shak/.nvm/versions/node/v8.11.4/lib/node_modules/npm/lib/audit.js:168:6)
8 verbose stack at Object.commandCache.(anonymous function) (/Users/shak/.nvm/versions/node/v8.11.4/lib/node_modules/npm/lib/npm.js:159:13)
8 verbose stack at EventEmitter. (/Users/shak/.nvm/versions/node/v8.11.4/lib/node_modules/npm/bin/npm-cli.js:129:30)
8 verbose stack at _combinedTickCallback (internal/process/next_tick.js:131:7)
8 verbose stack at process._tickCallback (internal/process/next_tick.js:180:9)
9 verbose statusCode 400
10 verbose cwd /Users/shak/projects/api/api
11 verbose Darwin 17.7.0
12 verbose argv “/Users/shak/.nvm/versions/node/v8.11.4/bin/node” “/Users/shak/.nvm/versions/node/v8.11.4/bin/npm” “audit” “fix”
13 verbose node v8.11.4
14 verbose npm v6.4.0
15 error code E400
16 error 400 Bad Request - POST https://registry.npmjs.org/-/npm/v1/security/audits
17 verbose exit [ 1, true ]

Reproduction Steps

Just running npm audit.

Details

Seems to be related to this issue: https://github.com/npm/npm/issues/20604 but can’t reply there.

Platform Info

$ npm --versions
6.4.0

$ node -p process.platform
darwin

(Kat Marchán) #2

duplicate of npm audit returns 400 from registry when non-registry packages satisfy specs that exist in the registry


(Kat Marchán) #3