npm Community Forum (Archive)

The npm community forum has been discontinued.

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

Bug found with NPM

What I Wanted to Do

Run $ npm audit fix

What Happened Instead

Unhandled rejection Error: EACCES: permission denied, rename ‘/Users/simonbolus/.npm/_cacache/tmp/de030842’ -> ‘/Users/simonbolus/.npm/_cacache/content-v2/sha512/78/08/d4470cfc385d74652835915afe209e8580dd62bae758730c140aac4c3a0f18b4c0c3825be944054e5ba704fc56103f80d0a7df6da5f170914a2527714ea4’

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/simonbolus/.npm/_logs/2019-03-22T15_49_38_788Z-debug.log

Reproduction Steps

Run $ npm audit fix


Just installed $ npm install --save angular-screenfull

0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/local/bin/node’, ‘/usr/local/bin/npm’, ‘audit’, ‘fix’ ]
2 info using npm@6.8.0
3 info using node@v8.11.4
4 verbose npm-session 1a405d31c98cf8ff
5 timing audit submit Completed in 842ms
6 http fetch POST 200 841ms
7 timing audit body Completed in 0ms
8 verbose audit installing [ ‘karma@4.0.1’,
8 verbose audit ‘@angular-devkit/build-angular>postcss-loader>postcss-load-config>cosmiconfig>js-yaml@3.13.0’,
8 verbose audit ‘karma-coverage-istanbul-reporter>istanbul-api>js-yaml@3.13.0’,
8 verbose audit ‘tslint>js-yaml@3.13.0’ ]
9 silly install loadCurrentTree
10 silly install readLocalPackageData
11 timing npm Completed in 2830ms
12 error cb() never called!
13 error This is an error with npm itself. Please report this error at:
14 error

Platform Info

$ npm --versions

npm: '6.8.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.32.0',
  node: '8.11.4',
  openssl: '1.0.2p',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.54',
  zlib: '1.2.11' 

$ node -p process.platform
<!-- paste output here -->


The short version is run this to fix the ownership, then try your command again:

sudo chown -R $(whoami) ~/.npm

The long version and canonical bug is: Global installs (sudo npm i -g) fail on Mac after 6.5 upgrade. Works fine after 6.4.1 downgrade.