javascript - { [Error: listen EADDRINUSE :::5000] -
what's wrong following server.js file? trying connect deployd heroku , keep getting following error. we're using nitrous, , have configure mongodb port 5000. appreciated. ton!
server.js
// require deployd var deployd = require('deployd'); // configure database etc. var server = deployd({ port: process.env.port || 5000, env: 'production', db: { host: '0.0.0.0', port: 5000, name: 'database_name', credentials: { username: 'username', password: 'password' } } }); // heroku requires these settings sockets work server.sockets.server.set('transports', ["xhr-polling"]); // start server server.listen(); // debug server.on('listening', function() { console.log("server listening on port: " + process.env.port); }); // deployd requires server.on('error', function(err) { console.error(err); process.nexttick(function() { // give server chance return error process.exit(); }); });
error:
db:error error: cannot open store: mongoerror: server 0.0.0.0:5000 timed out @ /home/nitrous/find-volunteerships/node_modules/deployd/lib/db.js:144:17 @ /home/nitrous/find-volunteerships/node_modules/mongodb/lib/mongo_client.js:330:20 @ /home/nitrous/find-volunteerships/node_modules/mongodb/lib/db.js:231:14 @ null.<anonymous> (/home/nitrous/find-volunteerships/node_modules/mongodb/lib/server.js:240:9) @ g (events.js:260:16) @ emittwo (events.js:87:13) @ emit (events.js:172:7) @ /home/nitrous/find-volunteerships/node_modules/mongodb-core/lib/topologies/server.js:493:23 @ commandcallback (/home/nitrous/find-volunteerships/node_modules/mongodb-core/lib/topologies/server.js:1149:20) @ callbacks.flushconnection (/home/nitrous/find-volunteerships/node_modules/mongodb-core/lib/topologies/server.js:103:9) @ null.<anonymous> (/home/nitrous/find-volunteerships/node_modules/mongodb-core/lib/topologies/server.js:408:24) @ emittwo (events.js:87:13) @ emit (events.js:172:7) @ null.<anonymous> (/home/nitrous/find- volunteerships/node_modules/mongodb-core/lib/connection/pool.js:144:10) @ g (events.js:260:16) @ emittwo (events.js:87:13) +0ms session:error error removing old sessions: database connection error +14ms unhandled rejection database connection error { [error: listen eaddrinuse :::5000] code: 'eaddrinuse', errno: 'eaddrinuse', syscall: 'listen', address: '::', port: 5000 }
Comments
Post a Comment