I am using mac terminal to access my amazon ec2 free tier. I installed node and npm using commands.
我正在使用mac终端访问我的amazon ec2免费套餐。我使用命令安装了node和npm。
but when I tried to install Coffee-Script using below command, it gives error and warnings. I don't know what to do. Please help me.
但是当我尝试使用下面的命令安装Coffee-Script时,它会给出错误和警告。我不知道该怎么办。请帮帮我。
[ec2-user@ip-xxx-xx-xx-xxx /]$ npm install -g coffee-script
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└── coffee-script@1.10.0
npm ERR! Linux 4.4.11-23.53.amzn1.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "coffee-script"
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Linux 4.4.11-23.53.amzn1.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "coffee-script"
npm ERR! node v6.3.1
npm ERR! npm v3.10.3
npm ERR! path npm-debug.log.3173130556
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.3173130556'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, open 'npm-debug.log.3173130556'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: 'npm-debug.log.3173130556' }
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! /npm-debug.log
Also I tried :
我也尝试过:
[ec2-user@ip-xxx-xx-xx-xx /]$ sudo npm install -g coffee-script
sudo: npm: command not found
1 个解决方案
#1
1
Your NPM installation is in a privileged space forcing you to use sudo
to make any changes. The problem, is that you're PATH isn't being passed to the sudo'd shell.
您的NPM安装位于特权空间,强制您使用sudo进行任何更改。问题是,你的PATH没有被传递给sudo'd shell。
You can modify the sudoers PATH by editing the secure_path
field in /etc/sudoers
.
您可以通过编辑/ etc / sudoers中的secure_path字段来修改sudoers PATH。
If you just want to get it installed, provide the full path to npm.
如果您只是想安装它,请提供npm的完整路径。
sudo $(which npm) install -g coffee-script
#1
1
Your NPM installation is in a privileged space forcing you to use sudo
to make any changes. The problem, is that you're PATH isn't being passed to the sudo'd shell.
您的NPM安装位于特权空间,强制您使用sudo进行任何更改。问题是,你的PATH没有被传递给sudo'd shell。
You can modify the sudoers PATH by editing the secure_path
field in /etc/sudoers
.
您可以通过编辑/ etc / sudoers中的secure_path字段来修改sudoers PATH。
If you just want to get it installed, provide the full path to npm.
如果您只是想安装它,请提供npm的完整路径。
sudo $(which npm) install -g coffee-script