How to fix npm permission issues when using WSL

I had some startup problems when I installed Ubuntu as a subsystem. I could install node and npm, but not global npm packages. If you get errors like this:

npm WARN checkPermissions Missing write access to /usr/local/lib
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink

Maybe this commands could help:

sudo mkdir /usr/local/lib/node_modules
sudo chown -R $USER /usr/local/lib/node_modules
sudo chown $USER /usr/local/bin/

Leave a Reply

Your email address will not be published. Required fields are marked *