Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.51k stars 2.62k forks source link

PM2 not looking for changes - watches problem #2986

Closed himanshu-vr closed 6 years ago

himanshu-vr commented 7 years ago

PM2 version - 2.5.0 Node version - 8.0.0 OS - ubunut 16.04 LTS Framework - sailsJs

PM2 is not looking for any changes made in controller or policies or in models, I have to stop it again and then restart it. Here is my process.json file

 {
    "apps" : [{
      "name"        : "vr_crs",
      "script"      : "app.js",
      "watch"     : true,
      "ignore_watch" : ["node_modules", "views"],
      "env": {
        "NODE_ENV": "development"
      },
      "env_local": {
        "NODE_ENV": "local"
      },
      "env_production" : {
         "NODE_ENV": "production"
      }
    }]
  }

and "pm2 start process.json --env local" that's how I am starting the pm2 local server . any help please

Unitech commented 7 years ago

lgtm, is the app.js at the root level of your app tree?

RyotaSugawara commented 7 years ago

I am also facing this problem.

PM2 version - 2.6.1 Node version - 8.2.0 OS - macOS Sierra 10.12.5

Here is my process.json file

{
  "apps": [{
    "name": "web",
    "script": "index.js",
    "restart_delay": 500,
    "merge_logs": true,
    "log_date_format": "YYYY-MM-DD HH:mm Z",
    "watch": [
      "build"
    ],
    "interpreter_args": "--harmony"
  }]
}

and this is my app tree.

.
├── build
├── index.js
├── package.json
└── process.json

and start script is pm2 start process.json. It seems that it is not watching any files.

meetzoo commented 7 years ago

Is this with Docker? Have you tried

"watch_options": {
    "usePolling": true,
  }

? This worked for me as stated on http://pm2.keymetrics.io/docs/usage/watch-and-restart/. High cpu usage though, I also added 'interval: 5007' and it made things better. Problem appeared after switching from docker-compose to docker swarm. Might be from this https://github.com/docker/for-mac/issues/148. Anyway, it solved my issue on OSX.

wallet77 commented 6 years ago

Closing due to lack of activity. Feel free to reopen if necessary.