Resolve NPM Access Denied Errors (Error: EACCES) in WSL

I came this issue (Error: EACCES) while I was trying to install an NPM package on my Windows Subsystem for Linux (WSL). It has to do with the way Node is installed on WSL so if you try to install NPM packages on the global level.

To resolve this, you can remap the location that NPM modules are installed to one that you have full permission. This can easily be done by firing up you Bash window and typing the following:

mkdir ~/.npm-new  
npm config set prefix '~/.npm-new'  
export PATH=~/.npm-new/bin:$PATH  
source ~/.profile  

You can now go ahead and install NPM packages without having to elevate to root (sudo) or hitting a brick wall of Access Errors.


  • Share this post on
comments powered by Disqus