CentOS安裝pm2

湖工電氣發表於2017-12-04

在上一篇《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":"any"} (current: {"os":"linux","arch":"x64"})

通常npm安裝的時候有警告可以直接忽略。這裡其實也是。但是執行pm2命令就一直提示不存在pm2這個時候就需要把pm2配置全域性變數了。

ln -s /usr/local/src/node-v8.9.0-linux-x64/bin/pm2  /usr/local/bin/pm2

執行這個就好了。

相關文章