admin管理员组

文章数量:1403187

When I use the mand: 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.onplete (fs.js:108:15)' ] }
npm ERR! 
npm ERR! Please try running this mand 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

When I use the mand: 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.onplete (fs.js:108:15)' ] }
npm ERR! 
npm ERR! Please try running this mand 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
Share Improve this question edited Dec 18, 2014 at 21:27 Anthony Forloney 91.9k14 gold badges118 silver badges116 bronze badges asked Dec 18, 2014 at 21:25 James MercerJames Mercer 1113 silver badges10 bronze badges 3
  • 1 Have you tried running the mand with sudo? – Anthony Forloney Commented Dec 18, 2014 at 21:27
  • A help window just pops up that tells me how to use npm. – James Mercer Commented Dec 18, 2014 at 21:31
  • Forgot to put install, thanks it worked – James Mercer Commented Dec 18, 2014 at 21:33
Add a ment  | 

2 Answers 2

Reset to default 6

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

sudo npm install -g bower

This line gives a lot of insight:

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

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

本文标签: javascriptnpm install g bower on AWS Amazon ami getting errorStack Overflow