New computer, fresh start. Was installing bower from terminal and got this ERR! message in return. Seems common, but i'm hesitant in forcing it with sudo.

  • OSX 10.10.3
  • git version 2.3.2 (Apple Git-55)
  • npm (2.9.1)
  • node v0.12.3 are installed.

npm install -g bower

npm ERR! tar.unpack untar error /Users/username/.npm/bower/1.4.1/package.tgz
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! node v0.12.3
npm ERR! npm  v2.9.1
npm ERR! path /usr/local/lib/node_modules/bower
npm ERR! code EACCES
npm ERR! errno -13

npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules/bower']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/bower',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/bower',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack: 
npm ERR!    [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR!      '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR!      'FSReqWrap.oncomplete (fs.js:95:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/username/npm-debug.log

You can't normally install command-line software without administrator permissions. Do as it says and run with sudo, and you will be able to proceed.

This isn't "forcing" it, it's just elevating your permissions to do something that isn't safe to have accessible to non-administrators, thus requiring sudo.

  • First part is not really correct - but needing sudo and the reason is correct – user151019 May 21 '15 at 21:29
  • Actually, it is. All binary directories require root access to write to. Do you have an unusual configuration? – William T Froggard May 21 '15 at 21:31
  • I have command line software installed in ~/bin - the issue is not command line but usable by multiple sirs (or the directory installed in is not per user) – user151019 May 21 '15 at 21:32
  • again, that is an unusual configuration. Normally the only bin directories that come with a Mac is /bin, /sbin, /usr/bin and /usr/sbin. All of those directories require root permissions to access. – William T Froggard May 21 '15 at 21:34
  • @Froggard thanks for your explanation. I did run sudo npm install -g bower and looks like bower got installed. Although when doing bower -v it return me with -bash: bower: command not found. What I'm I doing wrong? Thanks – user782245 May 22 '15 at 1:04

type sudo npm install -g bower

  • Welcome to Ask Different. We like answers to be more than just a single line. Ideally, you want to explain why your answer is *right." It also helps to provide links, citations, and/or screen shots. Please review our help section How to Answer on writing good answers to questions – Allan Jul 22 '16 at 3:49

You must log in to answer this question.

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