How to exit nodemon on a windows

Problem

I´am on a windows machine, and I understand that it is a little different here.

The problem is that I can't find any information on how I stop, kill or exit nodemon.

Problem courtesy of: Johan Hallager

Solution

For purposes of completeness, The correct answer is press Ctrl + C. Or you could also find it in task manager and kill it. This applies to pretty much anything on the command line.

Solution courtesy of: kentcdodds

Discussion

My experience here is that Ctrl+C leaves a node instance running in the background. If you want to kill the stack, when you try to restart 'nodemon server.js' or just 'node server.js' for that matter, you will get an EADDRINUSE error because the old node server has the port tied up. You have to find it by using ps -W | grep node in the terminal window, because the task manager wont show it. Also you can kill it with the process ID (PID) with taskkill. The /F is the 'force' parameter. Here we will kill the task with PID 7528.

$ taskkill /F /PID 7528

Then check ps -W | grep node again, and the node server should be gone, and the server will launch again.

Their docs show a few tricks on intercepting the shutdown command, but since they use a 'rs' command to restart, they could add a 'kill' command to shutdown the daemon.

Brian

Discussion courtesy of: Brian

This recipe can be found in it's original form on Stack Over Flow.