I am trying to start a process on port 3000 and 3080 in a node.js app. I want to check if these ports are already running processes and want to kill those processes.
I tried portscanner but no luck.
portscanner.findAPortInUse([3000], '0.0.0.0').then(port => {
console.log(`Port ${port} is available!`);
(async () => {
await killPortProcess(3000);
})();
});
How can I achieve this?
Try this: