• Register
0 votes
603 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

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 115 views
115 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 morrisBson 3.2k points
0 votes
1 answer 477 views
477 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 379 views
379 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
1 answer 302 views
302 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 mphil 2.3k points