How can I stop nodejs?
cptneko (5)

Hello. I have started an express+socketio server with the standard:

var app = express();
var server = http.Server(app);
server.listen(3000, () => console.log('listening on *:3000'));

code, but I cannot seem to be able to restart it since I have closed it and reopened. I get

Process crashed with: Error: listen EADDRINUSE: address already in use :::3000
    at Server.setupListenHandle [as _listen2] (net.js:1279:14)
    at listenInCluster (net.js:1327:12)
    at Server.listen (net.js:1414:7)
    at evalmachine.<anonymous>:17:8
    at Script.runInContext (vm.js:133:20)
    at Object.runInContext (vm.js:311:6)
    at evaluate (/run_dir/repl.js:133:14)
    at ReadStream.<anonymous> (/run_dir/repl.js:116:5)
    at ReadStream.emit (events.js:198:13)
    at addChunk (_stream_readable.js:288:12)

If I change the port then it stars but my client is unable to connect as the old version gets connected. So how could I stop the already running version and start the new one?

You are viewing a single comment. View All
mwilki7 (382)

Maybe you've done this already but try refreshing the page.
That error has happened to me before. I don't remember how I solved it, though.