Q:

Port address still occupied

I ran a php script on the localhost with chrome to execute the following node.js file, named test2.js:
var express = require("express");
var app = express();
var notams = require("notams");

app.get("/", function(req, resp){
notams(['LMMM', 'LMML'], { format: 'DOMESTIC' }).then(results => {
    resp.end(JSON.stringify(results));
});
});

    app.listen(1000, function (){
    console.log("Listening on Port 1337");
});

The php script used was the following:
<?php
echo shell_exec("node test2.js 2>&1");
?>

It worked well. The only thing that did not display is the console.log msg on the browser console. (Any reason why?)
My main problem was that when I changed the script to listen on another port, the previous port (1000) was still being used by the node, even after restarting the pc and closing the browser. How can I clear up the ports from the node? P.S.I'm running on Windows 10.

A:

Open the cmd in Administration mode.
Punch in netstat -a -b
Checkout who uses your port
taskkill /f /im [pid of the port 1000 got from previous command]

Hope it helps.

