About Us
IDKBlogs

  All  
Javascript
NodeJS
AngularJS
Angular2+
ReactJS
Others

Resolved Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

[Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] { errno: -13, code: 'EACCES', syscall: 'access', path: '/usr/local/lib/node_modules'}

  idkblogs.com      July 24, 2020

Shubham Verma

Shubham Verma


Resolved Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

S

ometime, while installing anything using npm, you can see the Error: Error: EACCES: permission denied, access '/usr/local/lib/node_modules' on your CMD or Terminal who prevent the installation.

In this article, we will resolved the error: EACCES: permission denied, access \'/usr/local/lib/node_modules\', This error comes due to the correct permission of files or folder to do any specific operation like READ, WRITE etc.',

Here I am trying to install the angular CLI but I was getting the error as:



see the below snapshot:
Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

Let's resolve this problem:

First you should check the file/folder permission by running below command:

ls -la /usr/local/lib/node_modules

See the snapshot:

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

You can see in the above snapshot, it is denying access just because of the node_module folder is owned by root


Now this permission needs to be changed by changing the root to your user, you need to know the current username of your system.
To get the username run the below command:

or


Now you can see the current username as: Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

Change the user:

Now its time to change the user (owner) and remove the problem.
To change the user (owner) of this folder, run the below command:


eg:

After this command, it will ask for password, enter the password and you'r done.

To confirm, check the below command to see the permission and user of that file/folder ( as you did earlier ):

ls -la /usr/local/lib/node_modules

See the snapshot:

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'


Now your problem should be solved, let's check by installing the angular CLI:

See the snapshot:

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

In the above image, you can see the Error: EACCES: permission denied, access '/usr/local/lib/node_modules' is resolved now.


Conclusion:

In this article, we saw how we can resolve the Error: EACCES: permission denied, access '/usr/local/lib/node_modules' problem and we can change the permission of any file/folder and also saw how we can get the current username of the system.


Thank you

for taking the time to read this article. If you’re interested in Node.js or JavaScript this link will help you a lot.



Copyright © 2020 IDKBlogs | All Right Reserved

About Us

Powered by : IDKBlogs

Last Update : 19/09/2020