npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

npm has no permission to rename folder in WSL

What I Wanted to Do

install coveralls

What Happened Instead

npm has no permission to rename some folder.

Reproduction Steps

  1. install wsl in window10
  2. install coveralls

How to fix

I am not sure who is this bug belongs to. but it can be fixied by sudo.

where node
sudo ln /home/paul/.nvm/versions/node/v10.7.0/bin/node /usr/bin/node
where npm
sudo /home/paul/.nvm/versions/node/v10.7.0/bin/npm install -D coveralls
sudo rm /usr/bin/node


npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Error: EACCES: permission denied, rename '/mnt/f/code/js/highcharts-tree/node_modules/.staging/fsevents-3769
52fa/node_modules/concat-map' -> '/mnt/f/code/js/highcharts-tree/node_modules/.staging/concat-map-03d88886'

npm ERR! path /mnt/f/code/js/highcharts-tree/node_modules/coveralls/node_modules/minimist
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/mnt/f/code/js/highcharts-tree/node_modules/coveralls/node_modules/minimist' -> '/mnt/f/code/js/h
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

Platform Info

$ npm --versions
<!-- paste output here -->
$ node -p process.platform
<!-- paste output here -->
$ uname -a
Linux DESKTOP-VAMO8F7 4.4.0-17763-Microsoft #379-Microsoft Wed Mar 06 19:16:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux

Hi Paul! You should not need to use sudo, and once you have used sudo then you may have files and folders that are owned by root instead of yourself which can cause problems.

From your project folder (/mnt/f/code/js/highcharts-tree) you could try running these:

# Reset ownership
sudo chown -R $(whoami) node_modules
# Then install WITHOUT using sudo
npm install -D coveralls

There is an open bug about permissions errors and sudo: Global installs (sudo npm i -g) fail on Mac after 6.5 upgrade. Works fine after 6.4.1 downgrade.