carson314 carson314 - 13 days ago 8
Node.js Question

PM2 Process always stopping after start process

I builded a node project with Express and Mongo, I want to deploy in a Ubuntu server in AWS using PM2, I've try start my process using a json config:

{
"apps" : [{
"name" : "notification_eva02",
"script" : "bin/www",
"watch" : "../",
"log_date_format" : "YYYY-MM-DD HH:mm Z"
}]
}


and run command:

pm2 start processes.json


enter image description here

But When I check
pm2 list


enter image description here

I have:


  • pm2 -v (2.1.6)

  • node -v (v4.2.6)

  • npm --version (3.5.2)

  • Ubuntu Server 16.04



The rarest thing is that on my windows 10 it works pm2

I hope anyone can help me in my problem

Answer

You have activated the watch & restart mode, I guess some files are changing and so your application get restarted automatically. Try disable the watch mode and see if your application does not restarts.