我最近尝试运行使用 pm2 和本教程创建的 nodejs 应用程序: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-18-04 然而,由于某种原因,它抛出此错误并且无法启动:
root@ip-XXXXXXXXXX:/home/ubuntu# systemctl status pm2-ubuntu.service
● pm2-ubuntu.service - PM2 process manager
Loaded: loaded (/etc/systemd/system/pm2-ubuntu.service; enabled; vendor preset: enabled)
Active: failed (Result: protocol) since Wed 2019-01-16 17:15:25 UTC; 5s ago
Docs: https://pm2.keymetrics.io/
Process: 1686 ExecStart=/usr/lib/node_modules/pm2/bin/pm2 resurrect (code=exited, status=0/SUCCESS)
Jan 16 17:15:25 ip-XXXXXXXXXX pm2[1686]: [PM2] Restoring processes located in /home/ubuntu/.pm2/dump.pm2
Jan 16 17:15:25 ip-XXXXXXXXXX pm2[1686]: ┌──────────┬────┬─────────┬──────┬──────┬────────┬─────────┬────────┬─────┬───────────┬──────┬──────────┐
Jan 16 17:15:25 ip-XXXXXXXXXX pm2[1686]: │ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │
Jan 16 17:15:25 ip-XXXXXXXXXX pm2[1686]: ├──────────┼────┼─────────┼──────┼──────┼────────┼─────────┼────────┼─────┼───────────┼──────┼──────────┤
Jan 16 17:15:25 ip-XXXXXXXXXX pm2[1686]: │ index │ 0 │ 1.0.0 │ fork │ 1394 │ online │ 0 │ 113s │ 0% │ 41.1 MB │ root │ disabled │
Jan 16 17:15:25 ip-XXXXXXXXXX pm2[1686]: └──────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴─────┴───────────┴──────┴──────────┘
我尝试使用 nano 编辑 pm2.pid 文件,但它不存在。我的安装有问题吗?我该怎么办?
PM2日志文件:
2019-01-16T16:51:39: PM2 log: ===============================================================================
2019-01-16T16:51:39: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
2019-01-16T16:51:39: PM2 log: Time : Wed Jan 16 2019 16:51:39 GMT+0000 (Coordinated Universal Time)
2019-01-16T16:51:39: PM2 log: PM2 version : 3.2.8
2019-01-16T16:51:39: PM2 log: Node.js version : 10.15.0
2019-01-16T16:51:39: PM2 log: Current arch : x64
2019-01-16T16:51:39: PM2 log: PM2 home : /home/ubuntu/.pm2
2019-01-16T16:51:39: PM2 log: PM2 PID file : /home/ubuntu/.pm2/pm2.pid
2019-01-16T16:51:39: PM2 log: RPC socket file : /home/ubuntu/.pm2/rpc.sock
2019-01-16T16:51:39: PM2 log: BUS socket file : /home/ubuntu/.pm2/pub.sock
2019-01-16T16:51:39: PM2 log: Application log path : /home/ubuntu/.pm2/logs
2019-01-16T16:51:39: PM2 log: Process dump file : /home/ubuntu/.pm2/dump.pm2
2019-01-16T16:51:39: PM2 log: Concurrent actions : 2
2019-01-16T16:51:39: PM2 log: SIGTERM timeout : 1600
2019-01-16T16:51:39: PM2 log: ===============================================================================
2019-01-16T16:51:39: PM2 log: App [index:0] starting in -fork mode-
2019-01-16T16:51:39: PM2 log: App [index:0] online
2019-01-16T16:56:59: PM2 log: pm2 has been killed by signal, dumping process list before exit...
2019-01-16T16:56:59: PM2 log: Deleting process 0
2019-01-16T16:56:59: PM2 log: Stopping app:index id:0
2019-01-16T16:56:59: PM2 log: App [index:0] exited with code [0] via signal [SIGHUP]
2019-01-16T16:56:59: PM2 log: pid=10369 msg=process killed
2019-01-16T16:56:59: PM2 log: Exited peacefully
2019-01-16T16:57:41: PM2 log: ===============================================================================
感谢所有帮助