Changing Node.js listening port

后端 未结 3 715
名媛妹妹
名媛妹妹 2020-12-06 04:34

I just installed node.js on Windows. I have this simple code which does not run:

I get: Error: listen EADDRINUSE

Is there a config file that

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-06 05:00

    I usually manually set the port that I am listening on in the app.js file (assuming you are using express.js

    var server = app.listen(8080, function() {
        console.log('Ready on port %d', server.address().port);
    });
    

    This will log Ready on port 8080 to your console.

提交回复
热议问题