Error EACCES permission denied access usr local lib node modules react

0 votes

What might be causing the error Error: EACCES: permission denied, access '/usr/local/lib/node_modules'?

npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/macbookmd101/.npm/_logs/2018-02-21T16_26_08_421Z-debug.log
Jul 22, 2020 in Angular by kartik
• 37,520 points
23,087 views

2 answers to this question.

+1 vote

Hello @kartik,

Change your file permissions like this

First check who owns the directory

ls -la /usr/local/lib/node_modules

It is denying access because the node_module folder is owned by root

drwxr-xr-x   3 root    wheel  102 Jun 24 23:24 node_modules

so this needs to be changed by changing root to your user but first run command below to check your current user:

id -un

OR

whoami

then change owner

sudo chown -R [owner]:[owner] /usr/local/lib/node_modules

OR

sudo chown -R ownerName: /usr/local/lib/node_modules

Hope it works!!

If you need to know more about React, Its recommended to join React.js Training Course today.

Thank you!!

answered Jul 22, 2020 by Niroj
• 82,840 points
Thank you! This solved the exact problem I was having this morning.

It's work for me but i give permission befor address like;

sudo chown -R ownerName: /usr/local/
0 votes
Hello @Kartik,

Problem is of permissions. same I was having in one of my nodejs script. I resolved simply by running the file using proper user.

>sudo su  [or whatever your user of nodejs ]

>node myscript.js    [what ever your way to run your VUE /Angular /React]

it work.

Don't change global permission of nodejs folder as it is not good practice, as there are lots of users using global nodejs modules or packages.

-Fedrik
answered Jun 16, 2021 by fedrik

Related Questions In Angular

0 votes
1 answer

Error:XMLHttpRequest GET not working in React.js

Hello @kartik, You should populate data with AJAX ...READ MORE

answered Jun 4, 2020 in Angular by Niroj
• 82,840 points
3,071 views
0 votes
1 answer

How can we go back to previous page after having some error on request made through current page ?

$route is used for deep-linking URLs to controllers ...READ MORE

answered Feb 11, 2020 in Angular by Niroj
• 82,840 points
1,248 views
0 votes
1 answer

From php returning JSON to JavaScript

Hii @kartik, You can use Simple JSON for PHP. ...READ MORE

answered Jun 5, 2020 in Java-Script by Niroj
• 82,840 points
1,017 views
0 votes
1 answer

How do I conditionally add attributes to React components?

Hello @kartik, For certain attributes, React is intelligent ...READ MORE

answered Jul 22, 2020 in Angular by Niroj
• 82,840 points
8,778 views
0 votes
1 answer

How to specify a port to run a create-react-app based project?

Hello @kartik, You could use cross-env to set the port, ...READ MORE

answered Jul 22, 2020 in Angular by Niroj
• 82,840 points
5,861 views
+1 vote
1 answer

How to make anchor tag with routing using Laravel?

Hey @kartik, First you have to go to ...READ MORE

answered Mar 18, 2020 in Laravel by Niroj
• 82,840 points
23,012 views
0 votes
1 answer

Error:Unable to access React instance (this) inside event handler

Hello @kartik, You can use an arrow function together with ...READ MORE

answered Jun 4, 2020 in Angular by Niroj
• 82,840 points
1,943 views
0 votes
1 answer

Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'

Hii kartik, Removing the node_modules and the package-lock.json ...READ MORE

answered Apr 22, 2020 in Angular by Niroj
• 82,840 points
16,340 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP