Wednesday 17 May 2017

Express/HTTP listen EADDRINUSE for every port?

This is quite weird i tried at least 30 ports on a CentOS 7 server for the express application and i keep getting:

Uncaught Exception:  listen EADDRINUSE :::1238
[ERROR] Stack Trace:  Error: listen EADDRINUSE :::1238
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at Server._listen2 (net.js:1253:14)

I tried various different ports and i am pretty sure that nothing is using these ports but i keep getting this error.

Here is my express code:

import http from 'http';
import express from "express";
import compression from 'compression';
import SocketIO from "socket.io";

let App = express();
let HTTPServer = http.Server(App);
let Socket = new SocketIO(HTTPServer);
App.use(compression({}));
HTTPServer.listen(1238, function() {
    console.log("Listening.."); 
});

I checked firewall is off, nothing should block the application. I have one more application runnig on port 8080 just fine. And i just can't get this one working. Any thoughts?



via Azarus

No comments:

Post a Comment