listen EADDRNOTAVAIL error in Node.js

前端 未结 11 754
陌清茗
陌清茗 2020-11-27 15:43

I installed Nginx and Node.js in my server.

When I try run my node.js file, I get an error:

node.js:201
        throw e; // process.nextTick error, or \'e         


        
11条回答
  •  情深已故
    2020-11-27 16:08

    Check your ip ipconfig adress and add any port 3004 for example. Code below finally work for me. In case if you want to access this server from other device in your network. Or just set local host ip to 127.0.0.1 and get access from your device.

    var server = require('http').createServer(app);
    server.listen(3004, '192.168.x.x', function () {
      console.log("Listening on port 3000!");
    });
    

提交回复
热议问题