# EADDRINUSE error

**URL:** <https://discourse.nodered.org/t/eaddrinuse-error/5192>\
**Category:** General\
**Created:** [26 November 2018 01:27 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192 "2018-11-26T01:27:39Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![salas81](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/salas81/32/4026_2.png) [@salas81](https://discourse.nodered.org/u/salas81)\
**Post date:** [26 November 2018 01:27 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/1 "2018-11-26T01:27:39Z")

</div>

Hi, I'm trying to launch wore-red from terminal but this is the error I get

25 Nov 17:24:18 - [info]

# Welcome to Node-RED

25 Nov 17:24:18 - [info] Node-RED version: v0.19.4  
25 Nov 17:24:18 - [info] Node.js version: v8.11.1  
25 Nov 17:24:18 - [info] Linux 4.14.79-v7+ arm LE  
25 Nov 17:24:21 - [info] Loading palette nodes  
25 Nov 17:24:26 - [info] Dashboard version 2.11.0 started at /ui  
25 Nov 17:24:27 - [info] Settings file : /usr/lib/node\_modules/node-red/settings.js  
25 Nov 17:24:27 - [info] Context store : 'default' [module=memory]  
25 Nov 17:24:27 - [info] User directory : /home/pi/.node-red  
25 Nov 17:24:27 - [warn] Projects disabled : editorTheme.projects.enabled=false  
25 Nov 17:24:27 - [info] Flows file : /home/pi/.node-red/flows\_raspberrypi.json  
25 Nov 17:24:27 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/)  
25 Nov 17:24:27 - [warn]

* * *

Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials  
file will not be recoverable, you will have to delete it and re-enter  
your credentials.

## You should set your own key using the 'credentialSecret' option in your settings file. Node-RED will then re-encrypt your credentials file using your chosen key the next time you deploy a change.

25 Nov 17:24:27 - [info] Starting flows  
25 Nov 17:24:29 - [info] Started flows  
25 Nov 17:24:29 - [red] Uncaught Exception:  
25 Nov 17:24:29 - Error: listen EADDRINUSE :::1880  
at Object.\_errnoException (util.js:1022:11)  
at \_exceptionWithHostPort (util.js:1044:20)  
at Server.setupListenHandle [as \_listen2] (net.js:1367:14)  
at listenInCluster (net.js:1408:12)  
at Server.listen (net.js:1492:7)  
at EventedHTTPServer.listen (/home/pi/.node-red/node\_modules/node-red-contrib-homekit/node\_modules/hap-nodejs/lib/util/eventedhttp.js:60:19)  
at HAPServer.listen (/home/pi/.node-red/node\_modules/node-red-contrib-homekit/node\_modules/hap-nodejs/lib/HAPServer.js:158:20)  
at Accessory.publish (/home/pi/.node-red/node\_modules/node-red-contrib-homekit/node\_modules/hap-nodejs/lib/Accessory.js:607:16)  
at new HAPServiceNode (/home/pi/.node-red/node\_modules/node-red-contrib-homekit/homekit.js:79:17)  
at createNode (/usr/lib/node\_modules/node-red/red/runtime/nodes/flows/Flow.js:305:18)  
at Flow.start (/usr/lib/node\_modules/node-red/red/runtime/nodes/flows/Flow.js:89:35)  
at start (/usr/lib/node\_modules/node-red/red/runtime/nodes/flows/index.js:328:29)  
at tryCatchReject (/usr/lib/node\_modules/node-red/node\_modules/when/lib/makePromise.js:845:30)  
at runContinuation1 (/usr/lib/node\_modules/node-red/node\_modules/when/lib/makePromise.js:804:4)  
at Fulfilled.when (/usr/lib/node\_modules/node-red/node\_modules/when/lib/makePromise.js:592:4)  
at Pending.run (/usr/lib/node\_modules/node-red/node\_modules/when/lib/makePromise.js:483:13)

Any pointers? Looks like port 1880 is already in use, I think it happened after a deploy crashed.

Thanks  
Lorenzo

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [26 November 2018 05:32 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/2 "2018-11-26T05:32:18Z")

</div>

I assume this is a Raspberry Pi.

Have you tried to restart ?

How did you perform the install ?? - with the standard script for Node-red etc ?

How are you starting Node-red on the machine normally ?

You could also try

netstat | grep 1880 to see what is attach to that port and then also

ps aux | grep node-red

this will show you if node-red is running and what user it is running under - it will also provide the process ID for you to kill it

Craig

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 November 2018 09:07 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/3 "2018-11-26T09:07:26Z")

</div>

> [@salas81](#):
>
> Any pointers? Looks like port 1880 is already in use, I think it happened after a deploy crashed.

That almost certainly means that node-red is already running. As others have suggested then try a reboot.

---

<div class="post-metadata">

**Author:** ![salas81](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/salas81/32/4026_2.png) [@salas81](https://discourse.nodered.org/u/salas81)\
**Post date:** [26 November 2018 16:45 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/4 "2018-11-26T16:45:19Z")

</div>

Rebooting is the first thing I tried. What I see is in the task manager a node process that keeps being created and it crashes on the terminal after a few seconds. It keeps restarting and crashes continuously.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 November 2018 17:02 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/5 "2018-11-26T17:02:32Z")

</div>

In a terminal run

```bash
node-red-stop
node-red-start

```

and see what happens. Post the output here if necessary.

---

<div class="post-metadata">

**Author:** ![salas81](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/salas81/32/4026_2.png) [@salas81](https://discourse.nodered.org/u/salas81)\
**Post date:** [26 November 2018 18:16 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/6 "2018-11-26T18:16:22Z")

</div>

Tried that, always the same thing happens: same console output and in the task manager a new "node" process is created, which stays there for a few seconds then it disappears and it gets recreated with different ID. Cycling endlessly.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [26 November 2018 18:33 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/7 "2018-11-26T18:33:49Z")

</div>

what happens if you `pgrep node` ? Is there already an instance of node running.  
If not then try `node-red blank.json` to try starting Node-RED with a new blank flow file...  
If that then runs - stop it and then retry with just `node-red` (so it will use you existing flow file)...  
If that then dies then there is something corrupt or a bad node in your flow file. If so you can start with the blank again, load your "old" flow file in an editor - and cut and paste it into the blank flow ( but not hit deploy... until you have worked out what is broken).

---

<div class="post-metadata">

**Author:** ![salas81](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/salas81/32/4026_2.png) [@salas81](https://discourse.nodered.org/u/salas81)\
**Post date:** [26 November 2018 18:44 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/8 "2018-11-26T18:44:39Z")

</div>

thanks a lot, I haven't tried this solution; I'll try it and let you know!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 November 2018 20:47 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/9 "2018-11-26T20:47:19Z")

</div>

I have just been looking at the log you posted at the start again. I don't think there is another node-red process running. The server starts up ok listening on port 1880 then a couple of seconds later the crash occurs, apparently to do with node-red-contrib-homekit, which seems to be trying to start another server on the same port. I suspect that is where the issue is.  
[Edit] You said the problem occurred initially when it crashed during a deploy. Was that when you attempted to deploy the homekit node, possibly you have specified port 1880 there, and there is a bug in the homekit node that does not trap the address in use error.

---

<div class="post-metadata">

**Author:** ![salas81](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/salas81/32/4026_2.png) [@salas81](https://discourse.nodered.org/u/salas81)\
**Post date:** [26 November 2018 21:14 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/10 "2018-11-26T21:14:40Z")

</div>

that is correct, there's no other node-red process running. I already had a flow with homekit nodes deployed, I added/modified something and then it crashed. Since then, this keeps happening and node-red cannot launch. kinda frustrating

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 November 2018 21:18 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/11 "2018-11-26T21:18:44Z")

</div>

In that case follow @dceejay's advice.

---

<div class="post-metadata">

**Author:** ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)\
**Post date:** [26 November 2018 21:56 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/12 "2018-11-26T21:56:51Z")

</div>

As per my original question - what are you using to run Node-red - PM2 ? or some other startup script ?

If it is PM2 - you have probably reset it to always restart - so even though Node-red crashes it will try and start it agaiin and go in an endless loop

Craig

---

<div class="post-metadata">

**Author:** ![salas81](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/salas81/32/4026_2.png) [@salas81](https://discourse.nodered.org/u/salas81)\
**Post date:** [26 November 2018 22:08 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/13 "2018-11-26T22:08:27Z")

</div>

no script to launch it, just node-red from the terminal.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 November 2018 22:18 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/14 "2018-11-26T22:18:07Z")

</div>

Assuming you have the standard Pi install using the install script from the docs then it will be using systemd to start node red. When you run `node-red-stop` or `start` that is using the systemd script. That script will automatically restart node-red if it fails which explains why it keeps restarting.  
Have you tried it with a blank flow as suggested by @dceejay? Run `node-red-stop` first to make sure it is not already running.

---

<div class="post-metadata">

**Author:** ![salas81](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/salas81/32/4026_2.png) [@salas81](https://discourse.nodered.org/u/salas81)\
**Post date:** [26 November 2018 22:30 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/15 "2018-11-26T22:30:16Z")

</div>

I've already tried running node-red-stop and the same keeps happening. The only thing I have left to try is @dceejay's solution, which I'll try later today. I'll let you know and thanks for the many feedbacks!

---

<div class="post-metadata">

**Author:** ![salas81](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/salas81/32/4026_2.png) [@salas81](https://discourse.nodered.org/u/salas81)\
**Post date:** [27 November 2018 02:08 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/16 "2018-11-27T02:08:58Z")

</div>

so, turns out the actual problem was in my flows; I launched node-red with a blank flows file and it worked, then launched again my original file and it died. So, I wiped my flows file and it works again. Luckily I had exported my flows so I saved 99% of my work.

Thanks everyone for the help!

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [27 November 2018 08:35 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/17 "2018-11-27T08:35:30Z")

</div>

You should have been able to Import/paste back in your broken flw and try to fix it up... but yes backups always good..

There is actually a one level backup kept as .flows\_{yourflowname}.json.backup which is the previous version before deploy - so sometimes that can just be renamed flows\_{yourflowname}.json to get you going again.

---

<div class="post-metadata">

**Author:** ![Srinidhi\_21](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Srinidhi\_21](https://discourse.nodered.org/u/Srinidhi_21)\
**Post date:** [30 January 2021 14:33 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/18 "2021-01-30T14:33:16Z")

</div>

I am facing the exact same problem as yours, how did u wipe your flows file? Pls help

---

<div class="post-metadata">

**Author:** ![Srinidhi\_21](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@Srinidhi\_21](https://discourse.nodered.org/u/Srinidhi_21)\
**Post date:** [30 January 2021 14:44 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/19 "2021-01-30T14:44:11Z")

</div>

How to import it, pls explain.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 January 2021 15:44 UTC](https://discourse.nodered.org/t/eaddrinuse-error/5192/20 "2021-01-30T15:44:02Z")

</div>

Which exact same problem? Whatever it is it is node-red has moved on a lot in the last two years so the cause may well not be the same. Please start a new thread and tell us what is happening. Also tell us what OS you are using and how you installed node-red.

[Next page](https://discourse.nodered.org/t/eaddrinuse-error/5192.md?page=2)
