Whenever i force stop (ctrl+c) the node server running with nodemon and afterwards call nodemon i get this error saying the port is already used .This error is very common in windows .What i did to fix the problem is to stop the running node process from task manager or using taskkill /f /im node.exe command.But this is very unhandy as i have to call the command manually every time when the issue comes.It would be nice if nodemon does the same automatically whenever the 'port is already in use' comes.
If I install nodemon in a project and use it from within node_modules it freezes my git bash. However, if I install and run it globally it works just fine.
To reword what the request is: In windows (ctrl+c) is only killing nodemon and not the underlying instance of NodeJS that was started by nodemon. This request is for nodemon to clean up after itself when it is terminated with ctrl+c by also terminating the underlying instance of NodeJS, or potentially have an alternative to ctrl+c to cleanly force stop everything.
I'm encountering this when nodemon just tries to restart the process due to file changes... highly annoying .. and defeats the purpose of nodemon. (I'm on MacOS)
for reference running the following commands to get the pid of the running node process and killing it will work on unix:
# lsof -i tcp:3030
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node <PID> <User> 13u IPv6 0x4c5fa3d679aa1ec3 0t0 TCP *:arepa-cas (LISTEN)
#kill -9 <PID>
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
It's four months later and I'm still facing this same exact issue.. it's extremely aggravating and has been happening for some time. I too am on OSX (macOS Sierra).
@Nickersoft 4 months later than what? If there's an issue, can you file a new issue with full details on how to replicate and versions you're running and maybe I can use that information to fix it or you're very welcome to raise a pull request that fixes the issue, I'd be happy to merge it.
Hey, @remy I just commented because I saw this issue was already brought up but closed due to inactivity and I just wanted to reopen the discussion as opposed to having several duplicate issues (such as #1164 and #702). I didn't plan on making my post a full description of a new issue, but rather just a comment stating the original issue seems to still be recurring. Unfortunately, it's a situation where while this issue is common, it does not happen constantly, and the behavior can sometimes be unpredictable. This makes it difficult to pinpoint exactly what is responsible for this issue, and therefore difficult to pinpoint reproduction steps, which is most likely why all past issues posted regarding it were closed due to inactivity. I recently restarted my computer and the issue has resolved itself, for now, however, if and when it happens again I'll fiddle with the source to see if I can track down what might be responsible or what code might be able to fix it. I apologize for not being able to provide set steps to reproduce the issue.
And I'm using what I believe is the latest version of nodemon, seeing I just upgraded (v1.14.12).
@Nickersoft can I suggest you raise a clean issue with what you're running. I've got a guess as to how and what you're seeing, but I want to see what you're seeing.
my os ubuntu min 18.3
I guess that node needs time to kill process.
my temporary method is to start nodemon delay
nodemon --config 1200ms
Most helpful comment
I'm encountering this when nodemon just tries to restart the process due to file changes... highly annoying .. and defeats the purpose of nodemon. (I'm on MacOS)
for reference running the following commands to get the pid of the running node process and killing it will work on unix: