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.
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With