Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Express 4 + pm2 watch not working

Tags:

I'm running pm2 with this:

pm2 start bin/www --watch ../

Problem is that when I update app.js in the root folder, it doesn't seem to be autorestarting node. Any ideas?

like image 922
ninjaneer Avatar asked Jan 11 '15 00:01

ninjaneer


1 Answers

Figured out a solution:

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

Put that on the root of your project, then run your pm2 as so:

pm2 start processes.json
like image 126
ninjaneer Avatar answered Nov 02 '22 23:11

ninjaneer