Wednesday, 15 March 2017

Error after changing node.js app ip address

I have a node API which is working well, I changed the i.p. address because I wanted to test my android app (using retrofit 2), everything is being done locally so I thought this is a necessary since both the are using 127.0.0.1. However when I changed my i.p. in my server.js file I get this error:

Error: listen EADDRNOTAVAIL 10.0.3.2:3400
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at Server._listen2 (net.js:1246:19)
    at listen (net.js:1295:10)
    at net.js:1405:9
    at _combinedTickCallback (internal/process/next_tick.js:77:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

Since everything is already tested and is working I thought it would be better for me to only share the server.js file, here it is:

var express = require('./configuration/express');
var mongoose = require('./configuration/mongoose');
var passport = require('./configuration/passport');

var db = mongoose();
var app = express();
var passport = passport();

app.set('port', process.env.PORT || 3400);

app.listen(app.get('port'), '10.0.3.2', function() {
    console.log('Server running on PORT: ' + app.get('port'));
});

Any additional information will also be greatly appreciated, thanks in advance.



via cordobaRobber

No comments:

Post a Comment