[MacPorts] #45518: Nodejs http server doesn't bind to port

MacPorts noreply at macports.org
Mon Oct 20 16:50:30 PDT 2014


#45518: Nodejs http server doesn't bind to port
---------------------------+--------------------------------
 Reporter:  knightcode1@…  |      Owner:  macports-tickets@…
     Type:  defect         |     Status:  new
 Priority:  Normal         |  Milestone:
Component:  ports          |    Version:  2.3.2
 Keywords:  yosemite       |       Port:  nodejs
---------------------------+--------------------------------
 I've got a Node/Express project with the relevant index.js code below.
 After upgrading to Mac OS Yosemite and properly following the migration
 instructions, the 'listen' call of the server fires its callback, which is
 supposedly called in response to the 'listening' event, but a subsequent
 'netstat -a' in another terminal does not show a bound socket on the
 specified port. I also confirmed that attempting to bind to a port below
 1024 without privileged access causes an exception. Above 1024 gets a
 silent error.... or a false positive really.

 {{{#!js
 var express = require('express');
 var http = require('http');

 var app = express();

 app.set('port', (process.env.PORT || 5000));
 // ... set a bunch of other stuff

 var server = http.createServer(app);
 server.listen(app.get('port'), function () {
   console.log("Node app is running at localhost:%d %d %s",
 app.get('port'), server.address().port, app.settings.env);
 });
 }}}

-- 
Ticket URL: <https://trac.macports.org/ticket/45518>
MacPorts <https://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list