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

步骤如下:

禁止开机启动:
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/


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