Error: listen EADDRNOTAVAIL: address not available 1.1.1.1:10502

Hello ! I have been working with modbus node red, and I configured a Server TCP in ip address 1.1.1.1:10502. When I have tried run node-red I have received this message
5 Feb 21:10:07 - Error: listen EADDRNOTAVAIL: address not available 1.1.1.1:10502
at Server.setupListenHandle [as _listen2] (net.js:1260:19)
at listenInCluster (net.js:1325:12)
at doListen (net.js:1458:7)
at process._tickCallback (internal/process/next_tick.js:63:19)

I am looking for this port with netstat and it's desapeer, I'm using MAC with 10.14 version
Thanks !

Can you show us how you have configured the tcp node?

// the tcp port that the Node-RED web server is listening on
uiPort: process.env.PORT || 1880,

Sorry, you have lost me, I thought you said you were using a TCP node. I think you need to explain a bit more what you are doing.

I was using Node-red Modbus Sever, and I configured a node with ip 1.1.1.1 and port 10502. I closed node-red and when I am trying open now this message appear in terminal, and it doesn't run node-red.

5 Feb 22:47:09 - [info] Node-RED version: v0.17.5
5 Feb 22:47:09 - [info] Node.js version: v10.15.1
5 Feb 22:47:09 - [info] Darwin 18.0.0 x64 LE
5 Feb 22:47:09 - [info] Loading palette nodes
5 Feb 22:47:10 - [info] Dashboard version 2.13.2 started at /ui
5 Feb 22:47:10 - [warn] ------------------------------------------------------
5 Feb 22:47:10 - [warn] [rpi-gpio] Info : Ignoring Raspberry Pi specific node
5 Feb 22:47:10 - [warn] [azureiothubnode] Error: azureiothub already registered (line:146)
5 Feb 22:47:10 - [warn] ------------------------------------------------------
5 Feb 22:47:10 - [info] Settings file : /Users/jmlejarza/.node-red/settings.js
5 Feb 22:47:10 - [info] User directory : /Users/jmlejarza/.node-red
5 Feb 22:47:10 - [info] Flows file : /Users/jmlejarza/.node-red/flows_MacBook-Pro-de-Julen.local.json
5 Feb 22:47:10 - [info] Server now running at http://127.0.0.1:1880/
5 Feb 22:47:10 - [info] Starting flows
5 Feb 22:47:10 - [info] Started flows
5 Feb 22:47:10 - [red] Uncaught Exception:
5 Feb 22:47:10 - Error: listen EADDRNOTAVAIL: address not available 1.1.1.1:10502
at Server.setupListenHandle [as _listen2] (net.js:1260:19)
at listenInCluster (net.js:1325:12)
at doListen (net.js:1458:7)
at process._tickCallback (internal/process/next_tick.js:63:19)

Which node are you using please? Probably node-red-contrib-something. I cant see one in the flows database that says it is a modbus server.

node: modbus-server

I have uninstalled node-red and reinstalled it, but the error persists

That's not surprising if you have left the old flow file. I don't see in that node where it provides a modbus server.
If you stop node-red, rename the flow file to something else (that's the file /Users/jmlejarza/.node-red/flows_MacBook-Pro-de-Julen.local.json) and then restart node-red it will start with an empty flow.

I don't find flow archives. How do I uninstall all node-red ?

Is your machine really on ip address 1.1.1.1 that's pretty unusual ?
(and in fact is a well known DNS server on the internet...)
If it's isn't then that's why it can't connect - as that is what you have asked it to connect to.

I have found flow archive and I have deleted it. It's running ! Thanks !

Hi.
I have similar error. Node-red doesn't work after configuring modbus, miss one number in adress... I didn't see in folder any file with flow configuration, but error still persist.

 Error: listen EADDRNOTAVAIL 12.0.0.1:11502
    at Server.setupListenHandle [as _listen2] (net.js:1343:19)
    at listenInCluster (net.js:1401:12)
    at doListen (net.js:1510:7)
    at _combinedTickCallback (internal/process/next_tick.js:142:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Unit entered failed state.
nodered.service: Failed with result 'exit-code'.
nodered.service: Service hold-off time over, scheduling restart.
Stopped Node-RED graphical event wiring tool.

I don't know what to do now...
Thanks for help!

You don't say what version of Node-RED you are running.

If you are on v0.20.x you can use the --safe flag on startup (see https://nodered.org/blog/2019/03/12/version-0-20-released#runtime)

But the node you are using shouldn't crash Node-RED. You should open an issue with the nodes author so they can fix it. (follow a link to the nodes github page from the nodes page on flows.nodered.org)

I suggest this testing. Change the hostname in the modbus-server node to localhost, redeploy the flow and see what happens. As @ukmoose explained you will need to start Node-RED in safe node to recover from the crash.

Thanks for reply.
Version Node-RED I use is v0.19.4
Working on RaspberryPi
OK... i don't know what happend, but when I stop Node-RED, then start manually it's starts normally, but without any nodes, flow or install palletes. But when I reboot Raspberry, there is an error.
I try remove Node-RED from systemctl service, to manually run it, bu effect is like previous (no flows, nodes...).

If you read the raspberry pi page in the docs https://nodered.org/docs/hardware/raspberrypi

it will show you how to stop the autorunning Node-RED.

If when you restart it has no flows what does the log say as to which flows file it is using?
If you look in the directory ~/.node-red/ are there other files where the name ends with flows.json?

While you are reading the page you might as well upgrade to get the latest version...

I update to latest version and now start without errors. But flows are empty... I need to make everything from the beginning.
In home directory is only one file flow*.json. Before update there was no files with flows.
Thanks for help.

If the were no files before you updated then you must have been running Node-RED differently.

How did you run Node-RED? You flows files will be somewhere...

Node-RED was added to systemctl and it start with system. After wrong config I try to fix it, I stop a Node-RED, and run it manually, then flows on graphical editor was clear. When I looking for files in home directory, there was no flow files.