在上一篇《CentOS上安装Node.js–v8.9.0》中在CentOS下安装node.js
需要配置环境变量。今天又安装pm2
,也需要配置环境变量。
安装:npm install -g pm2
这个一直:
[root@jkyx ~]# npm install -g pm2
/usr/local/src/node-v8.9.0-linux-x64/bin/pm2 -> /usr/local/src/node-v8.9.0-linux-x64/lib/node_modules/pm2/bin/pm2
/usr/local/src/node-v8.9.0-linux-x64/bin/pm2-dev -> /usr/local/src/node-v8.9.0-linux-x64/lib/node_modules/pm2/bin/pm2-dev
/usr/local/src/node-v8.9.0-linux-x64/bin/pm2-docker -> /usr/local/src/node-v8.9.0-linux-x64/lib/node_modules/pm2/bin/pm2-docker
/usr/local/src/node-v8.9.0-linux-x64/bin/pm2-runtime -> /usr/local/src/node-v8.9.0-linux-x64/lib/node_modules/pm2/bin/pm2-runtime
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/pm2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ pm2@2.8.0
added 116 packages and updated 1 package in 11.829s
主要是后面的两个警告:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/pm2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"x64"})
通常npm安装的时候有警告可以直接忽略。这里其实也是。但是执行pm2
命令就一直提示不存在pm2
这个时候就需要把pm2
配置全局变量了。
ln -s /usr/local/src/node-v8.9.0-linux-x64/bin/pm2 /usr/local/bin/pm2
执行这个就好了。