Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error when trying to launch node.js app with PM2 Cluster

Tags:

node.js

pm2

in an Ubuntu Server, I am unable to run the node.js app in cluster mode using PM2.

The command I use is :

PM2 start server.js --name Server -i max

When I list the PM2 processes, I can see the Server has Error status. I have tried looking into the log file generated by PM2 but it's empty.

I am however able to run the same server.js without the cluster mode using :

PM2 start server.js --name Server

like image 629
Benjamin Avatar asked Jun 04 '26 16:06

Benjamin


2 Answers

doing PM2 Kill and starting all the services again was the solution to above issue.

like image 51
Benjamin Avatar answered Jun 06 '26 07:06

Benjamin


You could also have used pm2 restart Server to restart it

If you use pm2 kill you will just kill all processes, to clean up afterwards i would recommend to use pm2 flush so all logfiles will be reset

like image 34
BraveButter Avatar answered Jun 06 '26 07:06

BraveButter



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!