how to stop node.js server
ctrl+c, usually does the trick.
Try from another terminal
Works in OS X and Linux. It may also prevent respawning node processes. For instance if a
node some_server.js is running it may that any normal
kill command (even
kill -9 <PID_of_that_process> will simply result in a respawn
node some_server.js process with a different PID. In that situation the only way to kill it is:
killall node. I solved this issue on Redhat Linux RHEL7 but it should work the same for most Linux OS.
If you are going to use the 'top' command to kill a process, you should try sending the '2' signal first, not '9'. Sending '9' is kind of like pulling the plug on your computer instead of issuing a shutdown command. It can sometimes have some undesirable consequences. Sending '2' has the same effect as
For reference, here are the different signals you can send to stop a process and what they mean: (from kill man page)
1 HUP (hang up) 2 INT (interrupt) 3 QUIT (quit) 6 ABRT (abort) 9 KILL (non-catchable, non-ignorable kill) 14 ALRM (alarm clock) 15 TERM (software termination signal)
Enter 'top' at command line and find the process ID of the process you want to kill. Press 'K', it will prompt you to enter the process id that you want to kill, enter it, and press enter. It will then ask what signal you want to transmit to the process, enter '9' and press enter. The process will be killed.