How to Modify the Port Number Listening to node Server under windows

  node.js, question

Under windows, first I opened a simple node server in the file server.js

server.listen(3000, function(){
 console.log("Server listening on port 3000.");

Before that, I created the http server and provided relevant callbacks for the static server. Then I visited in the browser and everything was normal. At this time, I wanted to change the listening port to 3001, so I changed the above code:

server.listen(3001, function(){
 console.log("Server listening on port 3001.");

Then press ctrl+C on the command line to shut down the server, and then rerun my code to turn on the server.

node server.js

Then access in the browser, unable to access.
However, can still be accessed.
In other words, the server process has not changed to port 3001 at all, and still listens to 3000.

I tried to shut down the server manually in js:


Then restart and monitor 3001, also does not work. I even restarted my machine, still unable to modify the port number the node server listens to!

I went to google and did not see any explanation. Since I have just started learning node.js, I still think it is probably a common sense mistake. Please not stint, thank you very much!

To see if port 3001 is occupied, win plus r cmd command netstat -aon