Reputation: 47088
I'm now getting this when trying to run npm i
:
npm i
npm ERR! path /home/ole/.npm/_cacache/index-v5/37/b4
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/home/ole/.npm/_cacache/index-v5/37/b4'
npm ERR! [OperationalError: EACCES: permission denied, mkdir '/home/ole/.npm/_cacache/index-v5/37/b4'] {
npm ERR! cause: [Error: EACCES: permission denied, mkdir '/home/ole/.npm/_cacache/index-v5/37/b4'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/home/ole/.npm/_cacache/index-v5/37/b4'
npm ERR! },
npm ERR! isOperational: true,
npm ERR! stack: 'Error: EACCES: permission denied, mkdir ' +
npm ERR! "'/home/ole/.npm/_cacache/index-v5/37/b4'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/home/ole/.npm/_cacache/index-v5/37/b4',
npm ERR! parent: 'config-chain'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ole/.npm/_logs/2019-05-14T21_15_39_992Z-debug.log
I've tried changing the ownership and permission of the files and deleting node_modules
in the project directory but none of these steps work. Thoughts?
Upvotes: 0
Views: 277
Reputation: 3855
There is an 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 your install again:
sudo chown -R $(whoami) ~/.npm
The long version and canonical bug is: https://npm.community/t/global-installs-sudo-npm-i-g-fail-on-mac-after-6-5-upgrade-works-fine-after-6-4-1-downgrade/4082
Upvotes: 1