aws-ec2上的权限问题

时间:2016-03-16 20:32:58

标签: node.js amazon-web-services amazon-ec2

我正在尝试让我的nodejs项目在aws-ec2上运行。 我试图安装bower有一个权限问题:

npm ERR! tar.unpack untar error /home/ec2-user/.npm/bower/1.7.7/package.tgz
npm ERR! Linux 4.1.17-22.30.amzn1.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! node v4.4.0
npm ERR! npm  v2.14.20
npm ERR! path /usr/local/lib/node_modules/bower
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir

npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/bower'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/bower']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
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:35:25',
npm ERR!      '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
npm ERR!      'FSReqWrap.oncomplete (fs.js:82: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/www/npm-debug.log

当我尝试sudo命令时,我得到了

sudo: npm: command not found

我在这里用选项1解决了 https://docs.npmjs.com/getting-started/fixing-npm-permissions

1 个答案:

答案 0 :(得分:0)

如果你得到

sudo: npm: command not found

然后您必须将其添加到PATH变量。

ElasticBeanstalk 中,像这样:

export PATH=/opt/elasticbeanstalk/node-install/node-v6.10.0-linux-x64/bin:$PATH