nodejs 后台运行pm2错误,卸载、重装

远程服务器项目更新后,不知怎么回事,npm start运行一切正常,客户端登陆测试都没问题,pm2部署后台运行就是起不来,以前一直都是pm2正常运行很久了,查看日志是pm2的问题,回想没对pm2有什么操作啊!重新安装pm2,还是不行,郁闷,只能求助网络了,查了很多也没看见有用的解决方法,还是到GitHub pm2项目issues找答案吧!找相识错误的试试,最后https://github.com/Unitech/pm2/issues/1466下面的答复解决了我的问题。

步骤如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
禁止开机启动:
pm2 unstartup
杀死守护程序:
pm2 kill
卸载:
npm remove pm2 -g
删除所有保存的配置和日志:
rm -rf ~/.pm2
重新安装:
npm install pm2 -g
重新pm2部署我的nodejs项目后台运行:
pm2 start pm2.production.json
出现了久违的pm2:
-------------

\_\_/\\\\\\\\\\\\\\_\_\_\_/\\\\\_\_\_\_\_\_\_\_\_\_\_\_/\\\\\_\_\_\_/\\\\\\\\\\_\_\_\_\_
\_\/\\\/////////\\\\_\/\\\\\\\_\_\_\_\_\_\_\_/\\\\\\\_\_/\\\///////\\\\_\_\_
\_\/\\\\_\_\_\_\_\_\_\/\\\\_\/\\\//\\\\_\_\_\_/\\\//\\\\_\///\_\_\_\_\_\_\//\\\\_\_
\_\/\\\\\\\\\\\\\/\_\_\/\\\\///\\\/\\\/\_\/\\\\_\_\_\_\_\_\_\_\_\_\_/\\\/\_\_\_
\_\/\\\/////////\_\_\_\_\/\\\\_\_\///\\\/\_\_\_\/\\\\_\_\_\_\_\_\_\_/\\\//\_\_\_\_\_
\_\/\\\\_\_\_\_\_\_\_\_\_\_\_\_\_\/\\\\_\_\_\_\///\_\_\_\_\_\/\\\\_\_\_\_\_/\\\//\_\_\_\_\_\_\_\_
\_\/\\\\_\_\_\_\_\_\_\_\_\_\_\_\_\/\\\\_\_\_\_\_\_\_\_\_\_\_\_\_\/\\\\_\_\_/\\\/\_\_\_\_\_\_\_\_\_\_\_
\_\/\\\\_\_\_\_\_\_\_\_\_\_\_\_\_\/\\\\_\_\_\_\_\_\_\_\_\_\_\_\_\/\\\\_\_/\\\\\\\\\\\\\\\\_
\_\///\_\_\_\_\_\_\_\_\_\_\_\_\_\_\///\_\_\_\_\_\_\_\_\_\_\_\_\_\_\///\_\_\///////////////\_\_


Runtime Edition

PM2 is a Production Process Manager for Node.js applications
with a built-in Load Balancer.

Start and Daemonize any application:
$ pm2 start app.js

Load Balance 4 instances of api.js:
$ pm2 start api.js -i 4

Monitor in production:
$ pm2 monitor

Make pm2 auto-boot at server restart:
$ pm2 startup

To go further checkout:
http://pm2.io/

-------------