I am getting the following error while installing PM2. I have also tried installing it locally but nothing seems to be working. please help.
安装PM2时出现以下错误。我也试过在本地安装它,但似乎没有任何工作。请帮忙。
Command:npm install pm2 -g
命令:npm install pm2 -g
anil@anil:~/Desktop/restapis$ npm install pm2 -g
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/pm2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 4.4.0-78-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "pm2" "-g"
npm ERR! node v6.10.3
npm ERR! npm v3.10.10
npm ERR! path ../lib/node_modules/pm2/bin/pm2
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/pm2/bin/pm2' -> '/usr/local/bin/pm2'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, symlink '../lib/node_modules/pm2/bin/pm2' -> '/usr/local/bin/pm2'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/pm2/bin/pm2',
npm ERR! dest: '/usr/local/bin/pm2' }
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/anil/Desktop/restapis/npm-debug.log
anil@anil:~/Desktop/restapis$ ^C
anil@anil:~/Desktop/restapis$ sudo chmod 777 /lib/node_modules/pm2/bin/pm2
chmod: cannot access '/lib/node_modules/pm2/bin/pm2': No such file or directory
anil@anil:~/Desktop/restapis$ x
1 个解决方案
#1
3
You are trying to instal PM2 as /usr/local/bin/pm2
and you need root access for that.
您正在尝试将PM2安装为/ usr / local / bin / pm2,并且您需要root访问权限。
Instead of:
代替:
npm install pm2 -g
you need:
你需要:
sudo npm install pm2 -g
Note that you need to be in the sudoers group.
请注意,您需要进入sudoers组。
Alternatively you can install Node in your home directory instead of system-wide and then you won't need sudo
for install -g
或者,您可以在主目录而不是系统范围内安装Node,然后安装-g就不需要sudo了
#1
3
You are trying to instal PM2 as /usr/local/bin/pm2
and you need root access for that.
您正在尝试将PM2安装为/ usr / local / bin / pm2,并且您需要root访问权限。
Instead of:
代替:
npm install pm2 -g
you need:
你需要:
sudo npm install pm2 -g
Note that you need to be in the sudoers group.
请注意,您需要进入sudoers组。
Alternatively you can install Node in your home directory instead of system-wide and then you won't need sudo
for install -g
或者,您可以在主目录而不是系统范围内安装Node,然后安装-g就不需要sudo了