How to host server on local router with Express.js on Mac OS X?

Asked

Viewed 194 times

1

Since I started using Mac I am no longer able to host a local server on my router with Express.

In Ubuntu just pass the router IP as second argument of app.listen and everything worked out: thus.

When I try to run the same code on Mac OSX I get the following error:

Error: listen EADDRNOTAVAIL
    at exports._errnoException (util.js:746:11)
    at Server._listen2 (net.js:1129:19)
    at listen (net.js:1172:10)
    at net.js:1270:9
    at dns.js:85:18
    at process._tickCallback (node.js:355:11)
    at Function.Module.runMain (module.js:503:11)
    at startup (node.js:129:16)
    at node.js:814:3
  • Try shutting down the OSX firewall to see if it’s the firewall that’s blocking access (under System Preferences > Security & Privacy > Firewall).

  • On this jsFiddle line that you have placed this IP is not on string... app.listen(3000, 168.192.1.1, function(err) {. You got that right? It should be app.listen(3000, '168.192.1.1', function(err) {

  • @Sergio Sim, this in string. The same code works on Linux.

  • @bfavaretto The firewall is totally off.

  • Is OSX IP dynamic or static? That IP you’re assigning comes from where? You have to give the IP of the machine you’re on.

  • @Sergio is the IP statico router.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.