Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exit nodemon on a windows

Tags:

node.js

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.

like image 512
Johan Hallager Avatar asked Jul 12 '13 10:07

Johan Hallager


People also ask

How do I manually restart Nodemon?

Running non-Node code While Nodemon is running, we can manually restart our application. So instead of stopping and restarting Nodemon, we can just type rs and press enter, and Nodemon will restart the server or the running process for us.

How do I quit Nodemon server Mac?

Nodemon is a Node. js developer tool that helps to watch for file changes and restarting the node application once a change is detected. At times, we will usually kill the node application by pressing Ctrl+C, but that doesn't always kill the Nodemon process properly.


2 Answers

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.

like image 128
kentcdodds Avatar answered Sep 19 '22 12:09

kentcdodds


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

like image 28
Brian Avatar answered Sep 18 '22 12:09

Brian