ADDRINUSE when node app is run the second time

Viewed 14
    node:events:498
          throw er; // Unhandled 'error' event
          ^
    
    Error: listen EADDRINUSE: address already in use 3003,
        at Server.setupListenHandle [as _listen2] (node:net:1313:21)
        at listenInCluster (node:net:1378:12)
        at Server.listen (node:net:1476:5)
        at Object.<anonymous> (/Users/yusufogunjimi/react-course/part4-backend-blog/index.js:8:8)
        at Module._compile (node:internal/modules/cjs/loader:1103:14)
        at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
        at Module.load (node:internal/modules/cjs/loader:981:32)
        at Function.Module._load (node:internal/modules/cjs/loader:822:12)
        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
        at node:internal/main/run_main_module:17:47
    Emitted 'error' event on Server instance at:
        at emitErrorNT (node:net:1357:8)
        at processTicksAndRejections (node:internal/process/task_queues:83:21) {
      code: 'EADDRINUSE',
      errno: -48,
      syscall: 'listen',
      address: '3003,',
      port: -1
    }

When I run node program to connect to mongodb i get the above error message. I am connecting on Port 3003 and when I shut down the server with Ctrl-C , a file gets saved in the current working directory with the name 3003, which is strange and its of type socket. For me to be able to run the application again. I had to rm the unwanted file 3003, and then run node application again

0 Answers
Related