remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development
http://nodemon.io/
MIT License
26.23k stars 1.72k forks source link

Nodemon not working in windows #2088

Closed cawoodm closed 1 year ago

cawoodm commented 1 year ago

Expected behaviour

Nodemon should terminate the nodejs process and restart it on windows 10.

Actual behaviour

Nodemon does not terminate the nodejs process, though it can restart it if I terminate it. It also logs no errors about not being able to terminate the process!

Steps to reproduce

It seems to be an issue on many but not all customer installations and may not be reproducable!

Detailed information

Similar to the long list of users in #1501 and other tickets nodemon just doesn't work - it is not sending signals to the node process.

We can confirm this by adding the following to our code and running nodemon --signal SIGHUP:

process.once('SIGHUP', function () {
  console.log('SIGHUP', '*****************');
});

This line is never logged and we can see from ProcMon that no signals are sent to the process. Nodemon says:

[nodemon] restarting due to changes...

But you can wait an hour and nothing happens.

Using the task manage, powershell, cports or any other task manager it is simple to kill the node process and nodemon will restart it.

The issue is that nodemon is not terminating the process. Whatever method it uses no longer works in Windows 10 - though it used to.

The ONLY fix, is to re-install the operating system.

What does not work:

Basically there seems to be a better way of killing processes in Windows (used by all other tools) and nodemon is not using it.

Dump


node: v16.18.1 nodemon: 2.0.20 command: C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\nodemon\bin\nodemon.js --dump cwd: C:\projects\order OS: win32 x64

{
  run: false,
  system: { cwd: 'C:\\projects\\order' },
  required: false,
  dirs: [ 'C:\\projects\\order' ],
  timeout: 1000,
  options: {
    dump: true,
    ignore: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**',
      re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/
    ],
    watch: [ '*.*', re: /.*\..*/ ],
    monitor: [
      '*.*',
      '!**/.git/**',
      '!**/.nyc_output/**',
      '!**/.sass-cache/**',
      '!**/bower_components/**',
      '!**/coverage/**',
      '!**/node_modules/**'
    ],
    ignoreRoot: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**'
    ],
    restartable: 'rs',
    colours: true,
    execMap: { py: 'python', rb: 'ruby', ts: 'ts-node' },
    stdin: true,
    runOnChangeOnly: false,
    verbose: false,
    signal: 'SIGUSR2',
    stdout: true,
    watchOptions: {},
    execOptions: {
      script: 'src/index.js',
      exec: 'node',
      args: [],
      scriptPosition: 0,
      nodeArgs: undefined,
      execArgs: [],
      ext: 'js,mjs,json',
      env: {}
    }
  },
  load: [Function (anonymous)],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [],
  watchInterval: null,
  signal: 'SIGUSR2',
  command: {
    raw: { executable: 'node', args: [ 'src/index.js' ] },
    string: 'node src/index.js'
  }
}
cawoodm commented 1 year ago

I'd also add that supervisor does work.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up. Thank you for contributing <3

github-actions[bot] commented 1 year ago

Automatically closing this issue due to lack of activity

spyda247 commented 1 year ago

The issue still persists.

djb160 commented 1 year ago

Yup issue persists:

Baterka commented 7 months ago

I was also able to reproduce it. On Win 11 it does not work, but on WSL2 Ubuntu it works. Its 100% Windows specific issue.

dacharch commented 7 months ago

This issue still occurs in windows 1