netstat -ano | findstr :<PORT>
taskkill //PID <PID> //F
OR
taskkill /PID <PID> /F
//Run this command in cmd
taskkill /F /IM node.exe
Find server pid:
lsof -i tcp:5000 (the 5000 is the port number)
kill the server:
kill -9 111119 (the 111119 is the pid)
First, you would want to know which process is using port 8081
sudo lsof -i :8081
this will list all PID listening on this port, once you have the PID you can terminate it with the following:
kill -9 {PID} (in my case it was the 5182)
NODE PORT
For windows open Task Manager and find node.exe processes.
Kill all of them with End Task.
process.stdin.resume();//so the program will not close instantly
function exitHandler(options, exitCode) {
if (options.cleanup) console.log('clean');
if (exitCode || exitCode === 0) console.log(exitCode);
if (options.exit) process.exit();
}
//do something when app is closing
process.on('exit', exitHandler.bind(null,{cleanup:true}));
//catches ctrl+c event
process.on('SIGINT', exitHandler.bind(null, {exit:true}));
// catches "kill pid" (for example: nodemon restart)
process.on('SIGUSR1', exitHandler.bind(null, {exit:true}));
process.on('SIGUSR2', exitHandler.bind(null, {exit:true}));
//catches uncaught exceptions
process.on('uncaughtException', exitHandler.bind(null, {exit:true}));