npm Community Forum (Archive)

The npm community forum has been discontinued.

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

Error updating node, instructed to report it here.

Ran # sudo npm install n -g
Returned:
Unhandled rejection Error: EACCES: permission denied, rename '/Users/marshall/.npm/_cacache/tmp/{number_removed}' -> '/Users/marshall/.npm/_cacache/content-v2/{hash_removed}' at Error (native)
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/marshall/.npm/_logs/2019-03-10T19_02_45_085Z-debug.log`

Debug log is the following:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node@6/6.9.2/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'n',
1 verbose cli '-g' ]
2 info using npm@6.7.0
3 info using node@v6.9.2
4 verbose npm-session {id_number}
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 timing npm Completed in 1000ms
8 error cb() never called!
9 error This is an error with npm itself. Please report this error at:
10 error <https://npm.community>

What shall I do about this?


Thanks. There is an open issue with installing global packages using sudo leaving behind files with the wrong ownership.

The short version is run this to fix the ownership:

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.


ShadowSpawn, that you for the quick reply! I bailed on the update, and reverted things and worked around it, as it would have likely cause breaking changes to something I need to compete and ship out in the next few days. I’m happy to see the quick and helpful response though!