npm install -g bower on AWS Amazon ami收到错误

时间:2014-12-18 21:25:37

标签: javascript amazon-web-services amazon-ec2 bower mean-stack

当我使用命令时:npm install -g bower

我收到此错误:

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

2 个答案:

答案 0 :(得分:6)

您需要使用sudo运行命令,或者以具有写入/usr/local/lib权限的用户身份正常运行命令。

sudo npm install -g bower

答案 1 :(得分:2)

这一行提供了很多见解:

  

npm ERR!请尝试以root / Administrator方式再次运行此命令。

正如安东尼所说,请尝试使用sudo npm install bower -g