• Register
0 votes
864 views

Problem :

I am new to npm and now I am facing strange looking below error 

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

Detailed error as below:

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' }

Have somebody fixed this before?

8 4 2
2,300 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I had also faced such issues. I think currently you are facing permission issues. I think you are trying to install the npm-packages and getting the EACCES error while trying to install the package globally. The error is suggesting that you do not have the required permission to write to required directories which npm uses to store the global packages and commands.

To cross check try to run below commands: 

sudo chmod u+x -R 775 ~/.npm 

sudo chown $USER -R ~/.npm 

If you want to install the npm-package locally then in that case you should be in the local project directory and then you can try running below command

sudo npm install <pkg-name> 

The above command will install the required package. Now the purpose of using the sudo is to change the owner permissions so that you can make the current user authorized to run the npm commands.

5 2 1
4,980 points

Related questions

1 vote
2 answers 254 views
254 views
Problem : I am beginner to the monaca. Currently I am trying to install the monaca with the use of below command. npm install -g monaca But I am facing below errors after executing above command: npm WARN checkPermissions Missing write access to /usr/local/lib/ ... /lib/node_modules' } I am struggling with above error from past couple of days. Can somebody help me in fixing above monaca error?
asked Mar 27, 2020 morrisBson 3.2k points
0 votes
1 answer 811 views
811 views
Problem : I made the big mistake of trying remove all sudo dependencies. I simply downloaded npm as a package from the preferred site and did a manual global install. But I had to always run with the sudo. That's why I tried to uninstall and tried to run it with homebrew. ... once built. Run `brew link` on these: Now I am completely stuck and don't know how to solve it. Does anybody have any clue?
asked Nov 25, 2019 alecxe 7.5k points
0 votes
2 answers 639 views
639 views
Problem : I want to to run my NodeJS version with the nvm but getting following error: $ nvm use v4.2.4 nvm is not compatible with the npm config "prefix" option: currently set to "/Users/z/.npm-global"Run `npm config delete prefix` or `nvm use --delete- ... it. I have set the prefix on purpose to avoid the sudo npm How can I use nvm without losing the prefix for my globally installed packages?
asked Nov 29, 2019 alecxe 7.5k points
0 votes
0 answers 6 views
6 views
Problem: user "root" does not have permission to access the dev dir
asked Feb 19 Dan phillip 4.7k points
0 votes
1 answer 392 views
392 views
Problem : Currently I am learning Homebrew (Mojave). Recently I tried to install the node using Homebrew (Mojave) but after sometime my Php stopped working and now if I try to run the command php -v I face below error: php -v dyld: Library not loaded: /usr/local ... from: /usr/local/bin/php Reason: image not found I have also tried to uninstall my both node and icu4c but my problem still persists
asked Feb 20, 2020 mphil 2.3k points
0 votes
1 answer 21 views
21 views
Problem: HELP! I need help understanding this error :Local package.json exists, but node_modules missing, did you mean to install?.
asked Mar 6 Wafa Abu Yousef 6.1k points
0 votes
1 answer 3.9K views
3.9K views
Problem : I am trying to start the Redux application I just cloned from the GitHub repository. I tried to run it with the below command npm start But I am getting below error > react-redux@1.0.0 start /home/workspace/assignment > webpack-dev-server --config ./ ... output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install? How can I fix the above error?
asked Jan 20, 2020 jwilliam 3.9k points
0 votes
1 answer 27 views
27 views
Problem: error: the `brew link` step did not complete successfully.
asked Feb 23 Dan phillip 4.7k points
0 votes
1 answer 19 views
19 views
Problem: module build failed: error: cannot find module 'node-sass'
asked Feb 18 charles mathews 5.5k points