Bower Installation Errors
Solution 1
You need root access or permissions to install globally! Try :
sudo npm install -g bower
Solution 2
Much better than using sudo
is setting a user level prefix. For example in ~/.npmrc
set:
prefix = ${HOME}/npm-global
to use this folder for packages installed with -g
.
Then you also need to set your PATH
environment variable to include ${HOME}/npm-global/bin
.
Solution 3
you shouldn't sudo bower right? I mean sudo npm install -g bower will work BUT here's the message I got:
Additional error details: Since bower is a user command, there is no need to execute it with superuser permissions. If you're having permission errors when using bower without sudo, please spend a few minutes learning more about how your system should work and make any necessary repairs.
http://www.joyent.com/blog/installing-node-and-npm https://gist.github.com/isaacs/579814
You can however run a command with sudo using --allow-root option
Solution 4
If you've installed node/npm via Homebrew on OSX you may want to first run brew doctor
and follow instructions before sudo-ing any system folders. In my case this brought up a nag about agreeing to an Xcode/iOS license:
Builds will fail! Agree to the license by opening Xcode.app or running:
xcodebuild -license
After doing that and running a brew update
I was able to install Bower globally as expected.
Solution 5
I know that it's an old thread but I run into the issue recently after reinstalling Yosemite and xCode tools. In case anyone else gets stuck, what helped me was using the commands:
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
Following suggestion from the thread below: https://github.com/bower/bower/issues/2262
Comments
-
Hurricane Development almost 4 years
Now I have installed Node and Npm and I run this command in terminal (yes I am on a mac):
npm install -g bower
Which follows with this output from the terminal:
npm http GET https://registry.npmjs.org/bower npm http 304 https://registry.npmjs.org/bower npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/bower' npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'] npm ERR! errno: 3, 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:37:53', npm ERR! 'Object.oncomplete (fs.js:107:15)' ] } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! System Darwin 13.0.0 npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "bower" npm ERR! cwd /Users/Superfunnytogo npm ERR! node -v v0.10.25 npm ERR! npm -v 1.3.24 npm ERR! path /usr/local/lib/node_modules/bower npm ERR! fstream_path /usr/local/lib/node_modules/bower npm ERR! fstream_type Directory npm ERR! fstream_class DirWriter npm ERR! code EACCES npm ERR! errno 3 npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/bower' npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23 npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53 npm ERR! fstream_stack Object.oncomplete (fs.js:107:15) npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/Superfunnytogo/npm-debug.log npm ERR! not ok code 0 Device-365-352:~ Superfunnytogo$ npm install -g bower npm http GET https://registry.npmjs.org/bower npm http 304 https://registry.npmjs.org/bower npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/bower' npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/bower'] npm ERR! errno: 3, 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:37:53', npm ERR! 'Object.oncomplete (fs.js:107:15)' ] } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! System Darwin 13.0.0 npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "bower" npm ERR! cwd /Users/Superfunnytogo npm ERR! node -v v0.10.25 npm ERR! npm -v 1.3.24 npm ERR! path /usr/local/lib/node_modules/bower npm ERR! fstream_path /usr/local/lib/node_modules/bower npm ERR! fstream_type Directory npm ERR! fstream_class DirWriter npm ERR! code EACCES npm ERR! errno 3 npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/bower' npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23 npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53 npm ERR! fstream_stack Object.oncomplete (fs.js:107:15) npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /Users/Superfunnytogo/npm-debug.log npm ERR! not ok code 0
-
Hurricane Development over 10 yearsThank god I frigiin love this website, enjoy your first couple of reputation and welcome to Stack Overflow!
-
c0d3junk13 over 10 yearsThank you ! Glad I could help :D
-
VessoVit over 9 yearsUsing sudo, doesn't seem to be best of idea. Irsjng's answer seem to be better solution.
-
c0d3junk13 over 9 yearsThis is a sufficient answer for system wide global installing of npm modules, if you would like the modules to be restricted to each user you could do as Irsjng suggested.
-
Dingredient over 9 yearsthis doesn't work for me either. I get "sudo: npm: command not found"
-
c0d3junk13 over 9 yearsMy guess is that you have path reset on in /etc/sudoers but that is a separate issue
-
Richard Rowell over 7 yearsThank you so much. This is exactly what I was looking for. Using sudo to fix this is like using a sledge hammer to drive in finishing nails!