I am trying to deploy my node.js application for heroku, but when I try to run it locally using the wizard, I get Error: listen EADDRINUSE. I run netstat and grepped for the port, nothing uses it anymore, and the server starts without problems when starting directly as a node http server.
The application I'm trying to deploy uses mongo and redis. I'm not sure if these components will affect the server starting with Foreman. Does anyone have suggestions on areas that I could look at for possible errors?
foreman start 01:37:18 web.1 | started with pid 1835 01:37:18 web.1 | /usr/local/foreman/lib/foreman/process.rb:66: warning: Insecure world writable dir /usr/local in PATH, mode 040777 01:37:19 web.1 | events.js:72 01:37:19 web.1 | throw er; // Unhandled 'error' event 01:37:19 web.1 | ^ 01:37:19 web.1 | Error: listen EADDRINUSE 01:37:19 web.1 | at errnoException (net.js:863:11) 01:37:19 web.1 | at Server._listen2 (net.js:1008:14) 01:37:19 web.1 | at listen (net.js:1030:10) 01:37:19 web.1 | at Server.listen (net.js:1096:5) 01:37:19 web.1 | at Function.app.listen (/Users/craig/Documents/Sandboxes /xxx/node_modules/express/lib/application.js:535:24) 01:37:19 web.1 | at Object.<anonymous> (/Users/craig/Documents/Sandboxes/xxx/web.js:25:5) 01:37:19 web.1 | at Module._compile (module.js:456:26) 01:37:19 web.1 | at Object.Module._extensions..js (module.js:474:10) 01:37:19 web.1 | at Module.load (module.js:356:32) 01:37:19 web.1 | at Function.Module._load (module.js:312:12) 01:37:19 web.1 | exited with code 8 01:37:19 system | sending SIGTERM to all processes SIGTERM received
Thanks.
- Additional Information -
There is only one entry in the procfile: web: node web.js
and I set the listener as follows:
var port = process.env.PORT || 5000; app.listen(port, function() { console.log("Listening on " + port); });
Craig source share