0

I was recently trying to run a nodejs app I created using pm2 and this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-18-04 However, for some reason it throws this error and is unable to start:

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]: └──────────┴────┴─────────┴──────┴──────┴────────┴─────────┴────────┴─────┴───────────┴──────┴──────────┘

I tried editing the pm2.pid file with nano, but it does not exist. Is there something wrong with my install? What do I do?

PM2 logfile:

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: ===============================================================================

any and all help is appreciated

  • 1
    PM2 is unnecessary here (and this tutorial goes on the list of bad Internet tutorials). You can just start your Node app directly from a systemd unit. – Michael Hampton Jan 16 at 18:38
  • Thanks for sparing me, I dreaded having to use PM2 – Jake t Jan 16 at 18:59
  • @MichaelHampton While I do think that systemd mostly replaced existing process managers, I think pm2 is likely an exception, particularly for it's "cluster mode". – jordanm Jan 16 at 21:08
  • @MichaelHampton It worked! However, I now get an error that says "cannot get /" after configuring a reverse proxy with the following code location /iwl { proxy_pass http://localhost:6060; } You can see this in action at jakesandbox.com/iwl – Jake t Jan 16 at 21:27

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.