I had this issue, and I thought it was a port issue, but it turned out to be an IP issue.
I had my HOST
environmental variable pointing to a static IP, and my Node server was listening to that address. At some point when my router recycled, it started assigning my machine a new IP, and I started getting the error you posted. It was fixed by changing the address my server was listening to.
My config:
app.set('port', process.env.PORT || 3000);
app.set('host', process.env.HOST || '0.0.0.0');
http.createServer(app).listen(app.get('port'), app.get('host'), function(){
console.log("Express server listening on port " + app.get('port'));
});
Make sure your host is hitting your machine. In any case, the loopback, as @miltonb suggested, should always work:
app.set('host', '127.0.0.1');
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…