Unable to start nodejs application

I am trying to start nodejs server and receiving the following error no matter which port I choose to listen from:

root@nodejs-s-1vcpu-1gb-fra1-01:~/SalahTimes.PL# node server.js
      throw er; // Unhandled 'error' event

Error: listen EADDRINUSE: address already in use :::80
    at Server.setupListenHandle [as _listen2] (net.js:1313:16)
    at listenInCluster (net.js:1361:12)
    at Server.listen (net.js:1447:7)
    at Function.listen (/root/SalahTimes.PL/node_modules/express/lib/application.js:618:24)
    at Object.<anonymous> (/root/SalahTimes.PL/server.js:14:5)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
Emitted 'error' event on Server instance at:
    at emitErrorNT (net.js:1340:8)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  code: 'EADDRINUSE',
  errno: 'EADDRINUSE',
  syscall: 'listen',
  address: '::',
  port: 80

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

It looks like port 80 is already being used by another service. You can check which service exactly by running the following command:

netstat -plant | grep 80

You can not have more than 1 service listening on the same port.

What you could do is change the Node application port to 8080 for example so that it could start as normal.

I would also suggest following the steps here on how to prepare your Node application for production:

Hope that this helps! Regards, Bobby