Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/georgegunnee/.npm/_cacache/index-v5/a8/82'

What I Wanted to Do

I simply tried to use the npm upgrade:

$ npm upgrade

in an express application.

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/georgegunnee/.npm/_cacache/index-v5/fb/86'

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/georgegunnee/.npm/_cacache/index-v5/2f/d3'

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/georgegunnee/.npm/_cacache/index-v5/a8/21'

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/georgegunnee/.npm/_cacache/index-v5/45/fb'

Unhandled rejection Error: EACCES: permission denied, open '/Users/georgegunnee/.npm/_cacache/index-v5/79/6c/b472c31ce89294163d3d3d14ae4ad086e1b9049615a5b03257ad4155194b'

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/georgegunnee/.npm/_cacache/index-v5/55/84'

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/georgegunnee/.npm/_cacache/index-v5/a8/82'

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/georgegunnee/.npm/_cacache/index-v5/24/b5'

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/georgegunnee/.npm/_cacache/index-v5/54/ad'

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/georgegunnee/.npm/_cacache/index-v5/55/49'

macOs running Mojave v10.14.5
MacBook Pro (Retina, 15-inch, Late 2013)

$ npm --versions
6.9.0

$ node -p process.platform
v12.4.0

Hi @zuave! 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, then try the upgrade 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.

This did the job! Many thanks John… The strange thing is (though I could not replicate this) with v10.13.0 of node it worked find… or was that just a glitch?

Once again, many thanks…

1 Like