Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm install -g bower on AWS Amazon ami getting error

When I use the command: npm install -g bower

I get this error:

npm ERR! tar.unpack untar error /home/ec2-user/.npm/bower/1.3.12/package.tgz
npm ERR! Linux 3.14.20-20.44.amzn1.x86_64
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "bower" "-F"
npm ERR! node v0.10.34
npm ERR! npm  v2.1.14
npm ERR! path /usr/local/lib/node_modules/bower
npm ERR! code EACCES
npm ERR! errno 3

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:46:53',
npm ERR!      'Object.oncomplete (fs.js:108: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!     /home/ec2-user/var/www/html/npm-debug.log
like image 231
James Mercer Avatar asked Dec 05 '25 10:12

James Mercer


2 Answers

You need to either run the command using sudo or run the command normally as a user who has privileges to write to /usr/local/lib.

sudo npm install -g bower
like image 176
Greg Burghardt Avatar answered Dec 06 '25 22:12

Greg Burghardt


This line gives a lot of insight:

npm ERR! Please try running this command again as root/Administrator.

As Anthony mentioned, try using sudo npm install bower -g.

like image 23
Adam Avatar answered Dec 06 '25 23:12

Adam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!