Home > Enterprise >  Error "Permission denied" after execute npm install
Error "Permission denied" after execute npm install

Time:09-05

After executing npm install, occurs following error:

npm ERR! code 127
npm ERR! path /var/www/html/node_modules/core-js
npm ERR! command failed
npm ERR! command sh -c node -e "try{require('./postinstall')}catch(e){}"
npm ERR! sh: 1: node: Permission denied

I'm executing command as a root on Docker. I tried to set npm config set user 0 and npm config set unsafe-perm true but nothing changed.

CodePudding user response:

I changed files ownership to root, and after that everything work. chown -R root:root .

CodePudding user response:

This is a common problem when you install packages using sudo. That's why you shouldn't install any package using sudo keyword.

The solution: Delete node_modules folder. If it says that you don't have permission then delete it directly from folder (not from IDE) or through the terminal.

After that install your packages again. This time only npm i without sudo.

  • Related