EADDRINUSE :::3000 error - how do i fix this?

Posted June 29, 2017 54.3k views

If I try to do “node <script” i am presented with this error log:
Error: listen EADDRINUSE :::3000
at Object.exports.errnoException (util.js:1026:11)
at exports.
exceptionWithHostPort (util.js:1049:20)
at Server.setupListenHandle [as listen2] (net.js:1305:14)
at listenInCluster (net.js:1353:12)
at Server.listen (net.js:1453:7)
at Server.listen.Server.attach (/home/Bot/node
at Timeout._onTimeout (/home/Bot/site.js:1005:29)
at ontimeout (timers.js:488:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:283:5)
errno: 'EADDRINUSE’,
syscall: 'listen’,
address: ’::’,
port: 3000 }

anyone know how to fix?

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.

Submit an Answer
5 answers


That’s good you have backup - very important.

You shouldn’t need to install anything - except if you use non-standard Node modules.

Is it your own code or is it a project you have downloaded?
If it’s your own code, then you need to post it in so we can have a look at the configuration, because it seems like it’s not configured correctly.
If it’s a project, which and from where have you downloaded it?

Hi @k0ala

Something is already running and listening on port 3000 of the IPv6 interface.
Run this command to list the services running:

sudo lsof -iTCP -sTCP:LISTEN -P
    rpcbind  1690        root    8u  IPv4   4975      0t0  TCP *:111 (LISTEN)
    rpcbind  1690        root   11u  IPv6   4982      0t0  TCP *:111 (LISTEN)
    mysqld   2541       mysql   10u  IPv4   5726      0t0  TCP localhost:3306 (LISTEN)
    nginx    2563        root    6u  IPv4   5625      0t0  TCP *:80 (LISTEN)
    sshd     2584        root    3u  IPv4   5656      0t0  TCP *:22 (LISTEN)
    sshd     2584        root    4u  IPv6   5658      0t0  TCP *:22 (LISTEN)
    exim4    3010 Debian-exim    3u  IPv4   6240      0t0  TCP localhost:25 (LISTEN)
    exim4    3010 Debian-exim    4u  IPv6   6241      0t0  TCP ip6-localhost:25 (LISTEN)
    apache2  3581        root    4u  IPv6  12058      0t0  TCP *:8080 (LISTEN)
    apache2  3601    www-data    4u  IPv6  12058      0t0  TCP *:8080 (LISTEN)
    apache2  3602    www-data    4u  IPv6  12058      0t0  TCP *:8080 (LISTEN)
    apache2  3603    www-data    4u  IPv6  12058      0t0  TCP *:8080 (LISTEN)
    apache2  3604    www-data    4u  IPv6  12058      0t0  TCP *:8080 (LISTEN)
    apache2  3605    www-data    4u  IPv6  12058      0t0  TCP *:8080 (LISTEN)
    apache2  3624    www-data    4u  IPv6  12058      0t0  TCP *:8080 (LISTEN)
    nginx    3778    www-data    6u  IPv4   5625      0t0  TCP *:80 (LISTEN)
    nginx    3779    www-data    6u  IPv4   5625      0t0  TCP *:80 (LISTEN)
    nginx    3780    www-data    6u  IPv4   5625      0t0  TCP *:80 (LISTEN)
    nginx    3781    www-data    6u  IPv4   5625      0t0  TCP *:80 (LISTEN)
    apache2  3908    www-data    4u  IPv6  12058      0t0  TCP *:8080 (LISTEN)
    apache2  3975    www-data    4u  IPv6  12058      0t0  TCP *:8080 (LISTEN)
    apache2  4027    www-data    4u  IPv6  12058      0t0  TCP *:8080 (LISTEN)
    apache2 10186    www-data    4u  IPv6  12058      0t0  TCP *:8080 (LISTEN)


Okay, those configurations doesn’t seem to do anything and it doesn’t match the ports the services are listening on.

So you’re only interested in running a Node.js application ?

May I recommend that you start over by reinstalling the server, following this tutorial:

Otherwise you could start a droplet using the One-Click App, which would give you a pre-installed Node.js with Nginx (I think it comes with, but might be Apache).

by Brennen Bearnes
Node.js is an open source JavaScript runtime environment for easily building server-side and networking applications. Node.js applications can be run at the command line but this guide focuses on running them as a service using PM2, so that they will automatically restart on reboot or failure, and can safely be used in a production environment.
  • reinstalled and it does nothing, even if i run it with the pm2 thing
    I really do not want to start a new droplet…

    • @k0ala
      You cannot use PM2 until the Node application is running.
      Is it a home made application you’re trying to run or an application you’ve downloaded from somewhere, if yes, where?

    • And you can reinstall with a One-Click on the current droplet, if you don’t want to spin up another. Go to the control panel, click the droplet, click Destroy in the menu on the left, search for “NodeJS 6.11”, and click Rebuild.

      • damn it… wish you told me that it would reset all the files…… I didn’t have a backup… partly my fault though i wasnt paying attention and just did what you told me to

        • @k0ala

          I guess the “Destroy” was telling enough - and since you stated that you reinstalled just before that, then I guessed you didn’t have any data.

          • ok well apparently i saved the files and i got them back but i had to go through a bunch of reinstalls and it still doesn’t work because it gives me the eaddrinuse… I looked it up some more and people are telling me to change the port, but i don’t understand how to change it. here’s the error log

            [Error: listen EADDRINUSE] code:                    'EADDRINUSE', errno: 'EADDRINUSE', syscall: 'listen' }
            Error: listen EADDRINUSE
                at exports._errnoException (util.js:746:11)
                at Server._listen2 (net.js:1158:14)
                at listen (net.js:1184:10)
                at Server.listen (net.js:1269:5)
                at Server.listen.Server.attach (/home/Bot/node_modules/                   s:216:9)
                at null._onTimeout (/home/Bot/site.js:1005:29)
                at Timer.listOnTimeout (timers.js:119:15)

            I tried changing the number at “ at Server.listen.Server.attach (/home/Bot/node_modules/” as it describes here which is a port number, but that doesn’t do anything either. So how would i go about changing the port??

just power off the droplet by sudo poweroff and then switch the power on using control panel.