Administrator
Administrator
- Joined
- May 18, 2016
- Messages
- 83
Code:
sudo -u www npm install
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /home/www/.npm
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1000:1001 "/home/www/.npm"
If the error states that the /home/www/.npm directory doesn't exist, it's possible that the path provided in the error message might not be the exact location where npm is trying to write cache or the cache directory hasn't been created yet.
Here's how you can fix this:
- Create the directory if it doesn't exist: This will ensure the directory is available for npm to use.
Code:
sudo mkdir -p /home/www/.npm
2. Set the correct ownership: Assign the ownership to the www user and its group.
Code:
sudo chown -R 1000:1001 /home/www/.npm
3. Retry the npm command: Now you can run the npm install command as the www user
Code:
sudo -u www npm install