Node Red on Port 80


I would like to run node red on port 80 rather than 1880. I have changed the setting in settings.js but node red does not start with the error below. If I change back to 1880 it starts fine. Any advice appreciated

10 Aug 14:54:18 - [error] Uncaught Exception:
10 Aug 14:54:18 - [error] Error: listen EACCES
at Object._errnoException (util.js:992:11)
at _exceptionWithHostPort (util.js:1014:20)
at Server.setupListenHandle [as _listen2] (net.js:1338:19)
at listenInCluster (net.js:1396:12)
at doListen (net.js:1505:7)
at _combinedTickCallback (internal/process/next_tick.js:141:11)
at process._tickCallback (internal/process/next_tick.js:180:9)

I believe that a process running as an ordinary user cannot listen on low number ports. It is a security issue.

As Colin says - you can't use ports lower than 1024 if running as a normal user

You need to run node-red under sudo (if on a Pi) to get around this

But doing so causes other issues - best way to see the other issues is to try it out (but beware of things going horribly wrong!!)

Running using sudo won't cause things to go horribly wrong... But it isn't recommended.

There are lots of ways to allow a non-priviledged process to listen on port 80 without resorting to running the whole process as root.

For example:

1 Like

So to follow that link then

sudo setcap 'cap_net_bind_service=+ep'  $(eval readlink -f `which node`)

should do it (for Linux) - sets the node.js executable to be able to do this.

To follow up on the running as root... while probably not the end of the world on small single user systems it generally considered a bad thing to run services that are quite as powerful as Node-RED as root as they could be corrupted and wipe disks, install bad apps, etc as they have full admin rights to the machine... From the Node-RED perspective the main issue is that the user directory is now the root user's directory rather than the existing user's - so users then say "where are my flows" - or "I can't find a node I installed" etc. You can instead start Node-RED with the -u {user-dir-name} parameter to force it to where they are...


Thanks. It is works for me.

1 Like