I broke Node-Red port bind

Hi all,

I was playing around with web sockets and found node-red-contrib-socketio.
I configured a socketio server and bound it to Node-Red in the config settings of the socketio node.

I wasn't having much luck with websockets (I'm brand new to this) so I unbound the binding (sets it to port 80) and I think that broke my Node-Red - because now I am getting this when I run node-red.

3 Aug 22:32:26 - [info]

Welcome to Node-RED
===================

3 Aug 22:32:26 - [info] Node-RED version: v2.0.5
3 Aug 22:32:26 - [info] Node.js  version: v12.22.4
3 Aug 22:32:26 - [info] Linux 5.10.52-v7l+ arm LE
3 Aug 22:32:26 - [info] Loading palette nodes
Initializing HAP-NodeJS v0.9.4...
3 Aug 22:32:31 - [warn] ------------------------------------------------------
3 Aug 22:32:31 - [warn] [node-red-node-rbe/rbe] 'rbe' already registered by module node-red
3 Aug 22:32:31 - [warn] ------------------------------------------------------
3 Aug 22:32:31 - [info] Settings file  : /home/pi/.node-red/settings.js
3 Aug 22:32:31 - [info] Context store  : 'default' [module=memory]
3 Aug 22:32:31 - [info] User directory : /home/pi/.node-red
3 Aug 22:32:31 - [warn] Projects disabled : editorTheme.projects.enabled=false
3 Aug 22:32:31 - [warn] Flows file name not set. Generating name using hostname.
3 Aug 22:32:31 - [info] Flows file     : /home/pi/.node-red/flows_MQTT-Server.json
3 Aug 22:32:31 - [info] Server now running at http://127.0.0.1:1880/
3 Aug 22:32:31 - [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.
---------------------------------------------------------------------

3 Aug 22:32:32 - [info] Starting flows
3 Aug 22:32:32 - [info] [socketio-config:7879b3ca09febe59] Created server on port 80
3 Aug 22:32:32 - [info] Started flows
3 Aug 22:32:32 - [red] Uncaught Exception:
3 Aug 22:32:32 - Error: listen EACCES: permission denied 0.0.0.0:80
    at Server.setupListenHandle [as _listen2] (net.js:1299:21)
    at listenInCluster (net.js:1364:12)
    at Server.listen (net.js:1450:7)
    at Server.attach (/home/pi/.node-red/node_modules/socket.io/dist/index.js:173:17)
    at Server.listen (/home/pi/.node-red/node_modules/socket.io/dist/index.js:146:21)
    at new socketIoConfig (/home/pi/.node-red/node_modules/node-red-contrib-socketio/socketio.js:24:10)
    at Object.createNode (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/util.js:86:27)
    at Flow.start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/Flow.js:179:44)
    at start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/flows/index.js:371:33)

I tried fixing this with nom remove node-red-contrib-socketio hoping it would fix the bind, but it didn't - I see it's still showing that there is still instances of socket.io showing up in the errors...

Please can someone help....
Thanks in advance

I ran sudo node-red and it ran:

3 Aug 23:13:53 - [info]

Welcome to Node-RED
===================

3 Aug 23:13:53 - [info] Node-RED version: v2.0.5
3 Aug 23:13:53 - [info] Node.js  version: v12.22.4
3 Aug 23:13:53 - [info] Linux 5.10.52-v7l+ arm LE
3 Aug 23:13:54 - [info] Loading palette nodes
3 Aug 23:13:56 - [info] Dashboard version 2.16.3 started at /ui
3 Aug 23:13:56 - [warn] Missing node modules:
3 Aug 23:13:56 - [warn]  - node-red-contrib-ibm-watson-iot (0.2.8): wiotp-credentials, wiotp in, wiotp out
3 Aug 23:13:56 - [warn]  - node-red-node-email (1.6.3): e-mail, e-mail in
3 Aug 23:13:56 - [warn]  - node-red-node-rbe (0.2.5): rbe
3 Aug 23:13:56 - [warn]  - node-red-node-sentiment (0.1.4): sentiment
3 Aug 23:13:56 - [warn]  - node-red-node-tail (0.0.2): tail
3 Aug 23:13:56 - [warn]  - node-red-node-twitter (1.1.5): twitter-credentials, twitter in, twitter out
3 Aug 23:13:56 - [warn]  - node-red-node-feedparser (0.1.14): feedparse
3 Aug 23:13:56 - [warn]  - node-red-contrib-play-audio (2.3.2): play audio
3 Aug 23:13:56 - [warn]  - node-red-node-pi-sense-hat (0.0.18): rpi-sensehat in, rpi-sensehat out
3 Aug 23:13:56 - [warn]  - node-red-node-ping (0.0.16): ping
3 Aug 23:13:56 - [warn]  - node-red-node-random (0.1.3): random
3 Aug 23:13:56 - [warn]  - node-red-node-serialport (0.8.6): serial in, serial out, serial request, serial-port
3 Aug 23:13:56 - [warn]  - node-red-node-smooth (0.1.0): smooth
3 Aug 23:13:56 - [info] Removing modules from config
3 Aug 23:13:56 - [info] Settings file  : /root/.node-red/settings.js
3 Aug 23:13:56 - [info] Context store  : 'default' [module=memory]
3 Aug 23:13:56 - [info] User directory : /root/.node-red
3 Aug 23:13:56 - [warn] Projects disabled : editorTheme.projects.enabled=false
3 Aug 23:13:56 - [warn] Flows file name not set. Generating name using hostname.
3 Aug 23:13:56 - [info] Flows file     : /root/.node-red/flows_MQTT-Server.json
3 Aug 23:13:56 - [info] Creating new flow file
3 Aug 23:13:56 - [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.
---------------------------------------------------------------------

3 Aug 23:13:56 - [info] Server now running at http://127.0.0.1:1880/
3 Aug 23:13:56 - [info] Starting flows
3 Aug 23:13:56 - [info] Started flows

But it seems like a fresh install of node-red. There are nodes that I have never had before... :man_facepalming:t3:
Have I broken it completely???

Your issue is trying to run node-red on port 80. Ports below 1024 are privileged.

there are thousands of pages of info related to listen EACCES: permission denied port 80

Because node-red is now running under a different home (the flows file is in roots home!)

If you run as the original user, your flows will still be present.


PS dont run node-red as sudo unless you absolutely must.

Hi @Steve-Mcl, thanks for the reply.
Ok, so the socketio changed the port somehow :man_facepalming:t3:

I searched for that error on google - the one you linked - I just couldn't figure out how to change the port back to 1880? From what I read, I thought it tried to run on port 1880 but failed due to the sock node, so then it went to port 80 - Clearly I was mistaken... :man_facepalming:t3:

How do I fix this issue?

How do I get node-red running in the "same home" as it used to?
By NOT running node-red as sudo??

Start node-red in safe mode & uninstall that node. Then restart node-red Hopefully that will fix the issue.

node-red --safe

If that doesn't work, cd to the .node-red (in normal user home) and do npm remove node-red-contrib-socketio

Ps, node-red has a working web socket node built in.

Thanks @Steve-Mcl, I started in safe mode and got into node-red with all my flows there. Tried to delete the 2 socketio nodes from a flow and node-red disconnected...

So I am busy running the second part, seems to be working so far...

Ps, node-red has a working web socket node built in.

I did see them, but my knowledge is lacking in that department - so was trying everything... #BadMove

Will let you know how it goes!!

@Steve-Mcl, thank you thank you thank you...

Back up and running!! Really can't thank you enough!!
I really need start backing up my whole node-red!

Thanks again!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.