Pm2: PM2 not looking for changes - watches problem

Created on 30 Jun 2017  ·  4Comments  ·  Source: Unitech/pm2

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

Pending Deletion In progress

Most helpful comment

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.

All 4 comments

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

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.

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lefam picture lefam  ·  3Comments

phra picture phra  ·  3Comments

FujiHaruka picture FujiHaruka  ·  3Comments

cchan picture cchan  ·  3Comments

rajendar38 picture rajendar38  ·  3Comments