Vuong Tran Vuong Tran - 1 year ago 486
Node.js Question

Expressjs pm2 ignore watch public/images folder

I have a website using nodejs. Problem is when user upload images the site stop working. That because of PM2 restart server when file change I think. How to solve this problem.
thank you

Answer Source

PM2 has special flag --ignore-watch flag.

Try creating file process.json in the same directory where your app.js/index.js is and paste this:

  "watch": ["server", "client"],
  "ignore_watch" : ["node_modules", "public/images"],
  "watch_options": {
    "followSymlinks": false

More on that topic:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download