I run npm install lodash but it throws Error: EACCES: permission denied error. I know it is permission issue but as far as I know, sudo permission
we need to give write permissions to that folder using:
sudo chmod 777 path-to-directory
path-to-directory in this project was (/home/ubuntu/blog/server)
This solved my issue straight away - mac Mojave 10.14.6 - PhpStorm.
Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/myname/.npm/_cacache/index-v5/fb/5a'
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
Original post: https://stackoverflow.com/a/50639828
FWIW I had the same symptoms, but with a different package. Creating package.json
and running npm init
did NOT solve my issue.
On this system, apparently new folders in this location were being created with root permissions. During npm install
, new folders are created. This caused npm install to fail partway, even with sudo.
The solution was to run npm install app
in a different location with no root umask.
Here's the solution for GNU/Linux (Debian) users (Replace USERNAME with your username):
sudo chown -R $USER:$(id -gn $USER) /home/USERNAME/.config
If you getting an error like below
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/<PackageName>/vendor'
I suggest using the below command to install your global package
sudo npm install -g <PackageName> --unsafe-perm=true --allow-root
Remove dist folder and this solve my problem!!