简体   繁体   中英

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

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

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

执行PM2 Kill并再次启动所有服务是上述问题的解决方案。

I have gone through this same kind of situations but in my case pm2 is showing error status cause of error in my code. use the below command

pm2 logs

pm2 logs command helped me by showing some hints to check where exactly the error is occured.

if everything works fine then pm2 list will show you the status online.

you can check the ports running by pm2(not only pm2 but all the process) using below command

sudo netstat -tulpn

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM