logo image

Error while starting NodeJS application - Error: listen EADDRINUSE :::80


Getting following exception while starting my NodeJS application

events.js:182
      throw er; // Unhandled 'error' event
      ^
Error: listen EADDRINUSE :::80
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at Server.setupListenHandle [as _listen2] (net.js:1315:14)
    at listenInCluster (net.js:1363:12)
    at Server.listen (net.js:1463:7)
    at Function.listen (/home/experimental/helloWorld/node_modules/express/lib/application.js:618:24)
    at Object.<anonymous> (/home/experimental/helloWorld/index.js:6:5)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)    

1 Answer

2 years ago by

EADDRINUSE error says the port 80 is already in use. You might be using it already for other service or the previous NodeJS process might have not killed properly.

If you want to kill the process that running on 80 port, you can use the following command.

kill -9 $(lsof -t -i:80)
2 years ago by Megamind