Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodemon not working in windows #2088

Closed
cawoodm opened this issue Dec 5, 2022 · 7 comments
Closed

Nodemon not working in windows #2088

cawoodm opened this issue Dec 5, 2022 · 7 comments
Labels
stale no activity for 2 weeks

Comments

@cawoodm
Copy link

cawoodm commented Dec 5, 2022

  • Versions: node@v16.18.1, win32@10.0.19044
  • nodemon -v: 2.0.20
  • Operating system/terminal environment (powershell, gitshell, etc): Windows
  • Using Docker? No
  • Command you ran: nodemon

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:

  • Trying older versions of nodemon (e.g. 1.18.0)
  • Adding C:\windows\system32 to the path
  • Deleteing node_modules and reinstalling
  • Changing the type of signal nodemon uses

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
Copy link
Author

cawoodm commented Dec 5, 2022

I'd also add that supervisor does work.

@github-actions
Copy link

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 github-actions bot added the stale no activity for 2 weeks label Dec 19, 2022
@github-actions
Copy link

Automatically closing this issue due to lack of activity

@spyda247
Copy link

The issue still persists.

@djb160
Copy link

djb160 commented Feb 10, 2023

Yup issue persists:

  • Win11 22H2 (OS Build 22621.1105)
  • Node.js v18.12.0
  • express v4.18.2

@Baterka
Copy link

Baterka commented Jan 26, 2024

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
Copy link

dacharch commented Feb 2, 2024

This issue still occurs in windows 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity for 2 weeks
Projects
None yet
Development

No branches or pull requests

5 participants