diff --git a/lib/application.js b/lib/application.js index 39f2b57b7d..039b277451 100644 --- a/lib/application.js +++ b/lib/application.js @@ -356,6 +356,11 @@ Origin.prototype.startServer = function (options) { app.server = server; // Create a http server var httpServer = require('http').createServer(server); + httpServer.on('error', error => { + if (error.code !== 'EADDRINUSE') return; + logger.log('error', `Port ${error.port} already in use. Please stop the server before continuing.`); + process.exit(); + }); app._httpServer = httpServer.listen(port, function() { // set up routes app.router = router(app);