Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nodejs error EADDRINUSE

Tags:

node.js

port

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

like image 993
Patryk Krawczyk Avatar asked Mar 12 '17 19:03

Patryk Krawczyk


2 Answers

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

like image 89
Guido Avatar answered Nov 03 '22 14:11

Guido


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.

like image 20
Matt Trifilo Avatar answered Nov 03 '22 13:11

Matt Trifilo