Process manager for Node.js
IMPORTANT COMMANDS
pm2 start –name server_name –watch
server name = Your prefer server name
watch flag to reflect code update
pm2 status
show the server statuspm2 restart server_name or ID
restart a single process, check the status for name or ID.pm2 restart all
restart all processpm2 logs server_name or ID –line 20
display log 20 lines to check any error occurspm2 show server_name or ID
display process details. check exec cwd, scrpit pathI use PM2 for handling my website contact form email server.
I got 500 error after restarted all PM2 process.
To solve,
- updated node version 8 > 20 (!!),
- reinstall PM2 and other node modules (actually I deleted all modules once and reinstall all)
- use .env for credential information such as SMTP user and key, so make sure .env info is reflected to PM2 through server code.
- And since update node and PM2, flush all old setting to start all the PM2 processes.

