I'm on Windows 10.
When I start a server with nodemon app.js two Node.js instance appear in the Task Manager.
If I use Git Bash command line when exit nodemon by pressing ctrl+c one of the Node.js process still running in the background, I've to kill that process manually to exit the server.
If I use PoweShell or Cmder/cmd it works fine, both process are killed on exit.
I'm believe I'm having similar experience. Here are some of my conditions when it occurs:
ctrl-c will work to end webpack process in the first git bash window, but won't work to end nodemon in the second git bash windowAbout the last point I'm in the same situation, I done a full uninstall of bash on ubuntu on windows but I don't think its connected with this bug
I am also having the same issue, since upgrading to Node 8.6.0. I'm not sure if this is relevant, but I had also performed a fresh reinstall of Windows 10. ctrl-c does not kill the process, it simply causes my terminal to hang. This happens in both Git Bash and CMD, but not Powershell. Attempting to restart the server (using either nodemon or plain node) results in EADDRINUSE errors in the server log files, unless I initially start the server with node, or manually kill the process (or I use Powershell). Here is my stacktrace caused by attempting to restart the server:
2017-10-11T08:46:14.034Z - error: uncaughtException: listen EADDRINUSE :::3000 date=Wed Oct 11 2017 09:46:14 GMT+0100 (GMT Summer Time), pid=7528, uid=null, gid=null, cwd=C:\Users\joewe\projects\node\webdev_backend_one, execPath=C:\dev\nodejs\node.exe, version=v8.6.0, argv=[C:\dev\nodejs\node.exe, C:\Users\joewe\projects\node\webdev_backend_one\api\index.js], rss=93454336, heapTotal=71921664, heapUsed=46749168, external=19470452, loadavg=[0, 0, 0], uptime=150502.5396814
Error: listen EADDRINUSE :::3000
at Object._errnoException (util.js:1019:11)
at _exceptionWithHostPort (util.js:1041:20)
at Server.setupListenHandle [as _listen2] (net.js:1344:14)
at listenInCluster (net.js:1385:12)
at Server.listen (net.js:1469:7)
at Function.listen (C:\Users\joewe\projects\node\webdev_backend_one\node_modules\express\lib\application.js:618:24)
at Object.<anonymous> (C:\Users\joewe\projects\node\webdev_backend_one\api\index.js:63:20)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Function.Module.runMain (module.js:665:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:607:3
Envrironment details:
EDIT:
Since updating to nodemon 1.12.0 I can run in CMD, Git Bash is still not working though.
i am also experiencing this issue, i have to kill the node processes in my task manager to be able to use the same port again
+1
same
options to resolve ?
Experiencing this since updating to latest version
I'm having the same issue - Any solutions yet?
I resolved the issue by using Windows PowerShell instead of git bash, it is installed with Windows so you don't need to install anything extra. If you start your nodemon application with PowerShell and press Ctrl + C then you will get the following message Terminate batch job (Y/N)? . Entering 'Y' here and then pressing enter will do the job.
To open PowerShell in the same way you open git bash by right-clicking inside folder, replace default CMD with PowerShell by following the steps mentioned here. After that you can just go to folder go to folder you want to open PowerShell to and press Shift + Right Click, this will show an extra option in menu saying Open PowerShell window here.
I'm also experiencing this issue running:
As a workaround I keep a cmd.exe shell open and just run: taskkill /F /IM node.exe to kill Node processes. I don't get any EADDRINUSE errors this way.
+1 same issue
+1 same issue
nodemon 1.12.1
Windows 10 OS
git 2.14.1
node 8.9.1
npm 5.5.1
Anyone having a go at PRs?
Can _someone_ try with the latest release: [email protected] (on node > 4)? It uses fork instead of spawn so it might solve this problem.
@remy [email protected] worked in my env. Thanks for the fix!
@remy Sorry for delay in testing/response
@tanyaYourchuck did you test on git bash? I just ran npm run dev on my project where:
"server": "cross-env NODE_ENV=development nodemon index.js",
"client": "npm run start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\""
package.json:
"devDependencies": {
"concurrently": "^3.5.1",
"cross-env": "^5.1.1",
"expect": "^21.2.1",
"jest": "^21.2.1",
"mocha": "^4.0.1",
"node-mocks-http": "^1.6.6",
"nodemon": "^1.12.6",
"supertest": "^3.0.0"
}
on:
It spawns a large number of node processes and ctrl+c only kills one of them.
Perhaps it's an issue with another package (concurrently)? Is anyone else still having this issue on git bash?
@vapurrmaid can you replicate without the concurrently app?
@remy Interestingly enough the issue only happens when I execute through a npm run script. If I call node_modules/nodemon/bin/nodemon.js index.js everything works fine.
I added this script: "temp":"nodemon index.js", ran npm run temp and ctrl+c just hung.
I ran this on npm 5.5.1. I'll update to 5.6.0 and see if it persists.
update
Issue still exists with 5.6.0, but again only if nodemon is called through npm run
I'm sure the bug stems from this issue as referenced here.
Further Update/Workaround
It indeed seems the issue is stemming from git-for-windows MinTTY. As a current workaround, use the shell located in C:\Program Files\Git\bin
This completely solved any issue I had before with ctrl+c and nodemon, regardless if called through npm.
@vapurrmaid yes, I'm using git bash, but using a gulp task to launch the process rather than npm script. In my env with nodemon v1.12.5, ctrl + c did not hang, it returned to prompt but left the node process running (thus still using the port). This was fixed with nodemon v1.12.6.
I tried to run the gulp task in an npm script. Then I observed same as you describe, ctrl+c just hung.
facing the smae
nodemon 1.12.4
Windows 10 OS
git 2.15.0
node 8.9.0
npm 5.5.1
em...
it has been resolved in 1.12.6,so,uninstall it and reinstall one later than 1.12.6
Updating git bash to 2.16 fixed this.
I solved this by creating a nodemon.json file in my root directory and adding and added the following:
"events":{
"restart":"fuser -k 8000/tcp && nodemon server"
}
@AndrewOdiit Thanks man, that did it.
Most helpful comment
Updating git bash to 2.16 fixed this.