I have a simple TCP server that listens on a port.
var net = require(\"net\");
var server = net.createServer(function(socket) {
socket.end(\"Hello!\\n\"
Ctrl+Z suspends it, which means it can still be running.
Ctrl+C will actually kill it.
you can also kill it manually like this:
ps aux | grep node
Find the process ID (second from the left):
kill -9 PROCESS_ID
This may also work
killall node
Late answer but on windows, opening up the task manager with CTRL+ALT+DEL then killing Node.js processes will solve this error.
For MacOS
Run the below code and hit enter
sudo kill $(sudo lsof -t -i:4200)
For windows first search the PID with your port number
netstat -ano | findStr "portNumber"
After that, kill the task, make sure you are in root of your "c" drive
And the command will be taskkill /F /PID your pid
$ sudo killall node
in another terminal works on mac, while killall node
not working:
$ killall node
No matching processes belonging to you were found
on linux try: pkill node
on windows:
Taskkill /IM node.exe /F
or
from subprocess import call
call(['taskkill', '/IM', 'node.exe', '/F'])