4

I get this when i type "node site.js" im 100% sure im not running this node twice.

    Error: listen EADDRINUSE :::3000
    at Object.exports._errnoException (util.js:1022:11)
    at exports._exceptionWithHostPort (util.js:1045:20)
    at Server._listen2 (net.js:1262:14)
    at listen (net.js:1298:10)
    at Server.listen (net.js:1376:9)
    at Server.listen.Server.attach (/root/node_modules/socket.io/lib/index.js:228:9)
    at Timeout._onTimeout (/root/nodejs/site.js:1005:29)
    at ontimeout (timers.js:365:14)
    at tryOnTimeout (timers.js:237:5)
    at Timer.listOnTimeout (timers.js:207:5)
  code: 'EADDRINUSE',
  errno: 'EADDRINUSE',
  syscall: 'listen',
  address: '::',
  port: 3000 }

Im using FEDORA 23

Guido
  • 42,125
  • 24
  • 113
  • 167

3 Answers3

8

Your site.js tries to listen twice on that port or something (another process) is already listening on port 3000. Find the service and stop/kill it. This command should help: lsof -i | grep 3000

Guido
  • 42,125
  • 24
  • 113
  • 167
4

Try running killall node, then node site.js again. If that doesn't work, at least you can rule out Node from the cause of this.

  • 2
    Try this command: `netstat -tulpn` This will list your ports in use, and the programs using them. Here are some [docs](https://docs.fedoraproject.org/en-US/Fedora/11/html/Security_Guide/sect-Security_Guide-Server_Security-Verifying_Which_Ports_Are_Listening.html) – Matt Trifilo Mar 12 '17 at 20:45
  • The `ss` utility should be available -- https://arkit.co.in/ss-utility-investigate-sockets-rhel-7/ – Matt Trifilo Mar 12 '17 at 20:57
  • i found other commad for netstat in fedora ( ss -tulpn) and i get this http://i.imgur.com/1Iv0nhl.png – Patryk Krawczyk Mar 12 '17 at 21:03
  • `ss` should list all of your ports currently in use. Port 3000 will be in there somewhere if it's being used by another program. – Matt Trifilo Mar 12 '17 at 21:12
  • If i change port 3000 to other np 4512 i get still same error but without ports 3000... :v – Patryk Krawczyk Mar 12 '17 at 21:55
  • works for me. But i did not understand why some process rest appended. i put it in package.json: "kill": "killall node" – Andrea Scarafoni May 05 '21 at 19:43
-2

Your site is listening twice to that port. You can check in your code whether you have 2 instructions .listen()