1

I read related posts on this question, but they don't help.

I'm running a Node-Express app in a windows environment using PM2 with pm2-windows-service. Until today it's been running node just fine and reloading Node when I save changes to my code. Today it stopped working. When I make changes, Node still serves up the old code. Even when I manually restart PM2. Plus, when I manually start PM2 it rapidly restarts Node until I kill Node with Task Manager.

Furthermore, even when I kill PM2, delete the PM2 app, and try manually running Node or nodemon, I still get the old code.

Baffling. Any theories?

Thank you!

Here's my ecosystem.config.js file:

module.exports = {
  apps : [{
    name: 'sm_api',
    script: 'server/index.js',
    log_date_format  : "YYYY-MM-DD HH:mm Z",

    // Options reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/
    args: 'one two',
    instances: 'max',
    error_file : "C:\\pm2_system\\.pm2\\logs\\sm-api-error",
    out_file: "C:\\pm2_system\\.pm2\\logs\\sm-api-out",
    autorestart: true,
    watch: true,
    max_restarts: 10,
    max_memory_restart: '1G',
    env: {
      NODE_ENV: 'development'
    },
    env_production: {
      NODE_ENV: 'production'
    },
    exec_mode: 'cluster'
  }],
};
208_man
  • 1,440
  • 3
  • 28
  • 59
  • if it "just" showed up and it pm2 restarts node all the time, there must be a problem with your code. Make sure you are watching for [uncaughtException](https://nodejs.org/api/process.html#process_event_uncaughtexception) – japrescott Jan 07 '19 at 19:21
  • Thanks @japrescott. Yes, I do have a problem with my code. The change that is not being "seen" by PM2 is a change to comment out the bad line of code. It won't "take". – 208_man Jan 07 '19 at 19:33
  • yes, thats because you must have errors in your code, like a SyntaxError or a TypeError. If that happens, most file-system watchers cant/wont reload – japrescott Jan 07 '19 at 20:15
  • 1
    @japrescott right you were. There was a require statement that was also accessing the bad code. Issue solved. Thank you! – 208_man Jan 08 '19 at 15:16

0 Answers0