Vuong Tran Vuong Tran - 3 months ago 45x
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


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: