How to fix EACCES: permission denied, access ‘/usr/local/lib/node_modules’

The permission error ‘EACCES permission denied access, /usr/local/lib/node_modules’ occurs in most cases when the user may have installed npm using a Node installer (which is not recommended since npm will be installed in a directory with local permissions which can give rise to permission errors in case npm packages are run globally, see documentation).

To fix the issue, you would need to use nvm to reinstall it (without suppressing npm).

Open up your terminal and run the command below:

curl -o- | bash

Read: How to manage permissions in Linux – guide for beginners

Next invoke the command :

nvm install stable

Which will install the package npm as well as node.js.

Read: How to install Node.js on Linux/Ubuntu

There is no need to modify the permissions.

You may want to refer to npm official page for more information.

If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.


amin nahdy

Amin Nahdy, an aspiring software engineer and a computer geek by nature as well as an avid Ubuntu and open source user. He is interested in information technology especially Linux based ecosystem as well as Windows and MacOS. He loves to share and disseminate knowledge to others in a transparent and responsible way.

Leave a Reply