0

I am logged in with my local acccount, I even sudoed to that account with SSH.

I tried to install Bower with the following command:

npm install -g bower

and I get this error:

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└── bower@1.7.9 

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! node v6.3.1
npm ERR! npm  v3.10.3
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!     at Error (native)

The error is pretty obvious, I have 2 questions:

  1. Why does it happen with my local super admin account?
  2. How can I fix this?
  • 1
    From what you wrote it seems you are running the command with a regular user account without the permission to write in the mentioned directory. The phrase "sudoed to that account with SSH" is incomprehensible. – techraf Aug 8 '16 at 3:02
  • 1
    How did you "sudoed to that account with SSH" – Mark Aug 8 '16 at 9:22
  • 1
    Please read this answer: apple.stackexchange.com/a/14423/22003 . – daniel Azuelos Aug 8 '16 at 13:35
2

Check your effective permission:

id

will tell you if you have the required priviledge (uid=0(root) ...).

Then be carefull upon using sudo. Be warned it is pretty easy to trap admin beginners into using a wrong sudo so as to steal their password. Always use the standard and explicit path of sudo:

/usr/bin/sudo npm ...

or if you prefer check that you aren't using the wrong one:

type sudo

which should reply with the correct answer:

sudo is /usr/bin/sudo

(and nothing else which would be a bad sign).

1

Try this command instead:

sudo npm install -g bower

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .