简体   繁体   中英

Express 4 + pm2 watch not working

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?

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

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