Nodemon: Nodemon child process not being killed with update to 1.18.0

Created on 10 Jul 2018  路  24Comments  路  Source: remy/nodemon

  • nodemon -v: 1.18.0
  • node -v: v8.11.2
  • Operating system/terminal environment: macOS 10.13.5/ZSH
  • Command you ran: nodemon --exec npx ...

Expected behaviour

In the previous version (1.17.5), Nodemon would properly kill the child process with ^C

Actual behaviour

After updating to 1.18.0, Nodemon no longer kills the child process and now throws an error:

npm ERR! code ELIFECYCLE
npm ERR! errno 1

Steps to reproduce

Update to 1.18.0 and run a child process like: nodemon --exec npx http-server. Hit control + C. See new error. The http-server will still be running and requires a killall node to exit.


If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.

has PR needs more info

Most helpful comment

@remy I had the same issue on Mac with 1.18.1, but it works fine with 1.18.2-alpha.1

All 24 comments

This is me running that command on my own Mac 10.13.5 using zsh:

screen shot 2018-07-10 at 21 36 43

1.18.0 does change how stdin is handled, so I can believe there's a problem here, but I can't replicate at the moment.

This is a gist of the package.json and I'm able to ctrl-c the process and the sub-process (in my case) does exit.

Are you able to include any more detail on what you're seeing?

(I'm shutting down for the night, but if you're able to give me more info I've pushed a version that has a tiny tweak that _might_ help - I'm not sure, you can test from npm i nodemon@debug - it should give you [email protected])

Mac 10.13.5 using Bash
I'm having the same issue even with [email protected].

screen shot 2018-07-10 at 5 15 40 pm

Looks like the same issue is happening on Windows. error is the result of pressing ctrl+c. The node task is not killed.

image

I can confirm this is an issue for me as well, I can kill the process on 1.17.5. The issue started appearing after I upgraded to 1.18.0. I am a Mac user.

I've published a new debug version - please can both windows and all other OS types test with this version - again, for myself, both 1.18.0 and debug versions work - but I'm using the exact same example provided by @nathanchapman.

To installed: npm i -g nodemon@debug - should yield [email protected]

Also encountered this error today in our dev shop (MacOS).

Temporary fix was to:

  1. Kill process sudo lsof -i tcp:3000 & kill -9 <pid>
    2. Delete node modules rm -rf node_modules
    3. Clear npm cache (npm cache clean --force or yarn cache clean if you're using yarn)
    4. Replace nodemon entry in your npm package-lock.json with entry for 1.17.5 (copy here: https://pastebin.com/S0aC2HWA)
    5. Reinstall node modules (npm install) and run app (npm run dev).
  2. Install 1.17.5 npm install [email protected] --save-dev --save-exact

Will test [email protected] in a moment @remy.

@remy Can confirm [email protected] exits gracefully (without issue error) for me (MacOS)

Before:
image

After:
image

I can also confirm [email protected] on GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17) is working as expected. Thanks for the quick fix!

Windows works as well

Okay, the fix is shipping now. It'll be on npm as 1.18.1 as soon as the tests have finished.

I'm still getting the error with 1.18.1:

npm ERR! code ELIFECYCLE
npm ERR! errno 130
npm ERR! [email protected] test-watch: `nodemon --exec npm test`
npm ERR! Exit status 130

1.18.1-alpha.2 is working correctly.

@ianrosedev can you explain what you're doing to run that command? i.e. so I can replicate?

Here's what I get when I hit control-c:

screen shot 2018-07-11 at 15 49 12

Left side shows running nodemon (which runs an http server from an npm command) - then on the right side, I curl the server - it responds ok.

I then control-c on the left, then try to curl on the right, and it fails (as the sub-process isn't running anymore).

@remy I'm running this this Mocha test script:
"test": "export NODE_ENV=test || SET \"NODE_ENV=test\" && mocha -r esm --exit server/**/*.test.js",

Here's what I get when I hit control-c:

screen shot 2018-07-11 at 10 59 21 am

I just noticed that on Windows too.

image

Happens with 1.18.1-alpha.2 and 1.18.2

correction
1.18.1-alpha.2 works properly

@ianrosedev did you get your prompt back and did the sub-process end? - so far your screenshots don't answer that question.

@remy sorry about that. Yes the prompt is coming back and the sub-process is ending.

Please can you try with the current debug version: npm install -g nodemon@debug (1.18.2-alpha.1)

I'm going to revert the change I made for handling ctrl-l if this fixes the issue.

@remy I had the same issue on Mac with 1.18.1, but it works fine with 1.18.2-alpha.1

@remy yes 1.18.2-alpha.1 is working correctly for me too.

1.18.2-alpha.1 works as expected for me as well! Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

piton13 picture piton13  路  3Comments

medoix picture medoix  路  4Comments

maotora picture maotora  路  4Comments

Bastorx picture Bastorx  路  5Comments

olalonde picture olalonde  路  3Comments