Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission Denied while installing Node on WSL using NVM

I tried to install Node LTS on WSL using NVM. While I successfully installed nvm, Node installation using nvm install --lts made some errors:

mv: cannot move '/home/anesin1109/.nvm/.cache/bin/node-v10.15.3-linux-x64/files/bin' to '/home/anesin1109/.nvm/versions/node/v10.15.3/bin': Permission denied
mv: cannot move '/home/anesin1109/.nvm/.cache/bin/node-v10.15.3-linux-x64/files/include' to '/home/anesin1109/.nvm/versions/node/v10.15.3/include': Permission denied
mv: cannot move '/home/anesin1109/.nvm/.cache/bin/node-v10.15.3-linux-x64/files/lib' to '/home/anesin1109/.nvm/versions/node/v10.15.3/lib': Permission denied
mv: cannot move '/home/anesin1109/.nvm/.cache/bin/node-v10.15.3-linux-x64/files/share' to '/home/anesin1109/.nvm/versions/node/v10.15.3/share': Permission denied

I tried to move these files manually, but it also ended with those errors.

like image 559
anesin1109 Avatar asked May 19 '19 01:05

anesin1109


2 Answers

Try making sure nothing is accessing the directory. I had this exact issue. I figured out that my VisualStudio Code had the directory open in the WSL which prevented NVM from doing its thing. After closing VS Code nvm install 12 worked fine. Hope that helps.

like image 80
KingCruzIII Avatar answered Oct 16 '22 14:10

KingCruzIII


Please check if your user owns all files in .nvm. You can take ownership recursively with chown -R <user> .nvm. Delete all node versions recursively with rm -rf .nvm/versions/node. Then try again; this process worked for me at least.

like image 36
Olaf Tietze Avatar answered Oct 16 '22 14:10

Olaf Tietze