Languages

Express.js - Error: listen EADDRINUSE: address already in use :::8080

3 points
Asked by:
Dragontry
731

Working with Express.js application, suddenly I got the following error. Can you help me to fix this?

Stack trace:

node:events:491
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::8080
    at Server.setupListenHandle [as _listen2] (node:net:1432:16)
    at listenInCluster (node:net:1480:12)
    at Server.listen (node:net:1568:7)
    at Function.listen (C:\Users\user\my-project\backend\node_modules\express\lib\application.js:635:24)
    at Object.<anonymous> (C:\Users\user\my-project\backend\index.js:75:5)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)        
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)   
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1459:8)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'EADDRINUSE',
  errno: -4091,
  syscall: 'listen',
  address: '::',
  port: 8080
}
2 answers
3 points
Answered by:
Dragontry
731

You probably have another process running on port :8080.

Quick solution for Windows:

  1. open Task Manager -> Details,
  2. find node.exe, right click to open menu and select End task.
Task Manager - end node.exe task
Task Manager - end node.exe task
0 comments Add comment
2 points
Answered by:
Dragontry
731

You can use command line.

e.g.

C:\> netstat -ano | findstr :8080
  TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING       8224
  TCP    [::]:8080              [::]:0                 LISTENING       8224

C:\> taskkill /PID 8224 /F
SUCCESS: The process with PID 8224 has been terminated.

 

See also

  1. Windows - kill process that listen on specific port using cmd.exe

  2. Windows - kill process by port number using cmd.exe

0 comments Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join