Error: listen EACCES

In UNIX-like systems, non-root users are unable to bind to ports lower than 1024.

This is a nuisance when proxying addresses on port 80. Typically, you end up sudoing all apps that must bind to such ports.

However, since kernel 2.6.24, you can use the setcap command to set specific capabilities to a program.

To enable all node programs to bind on any port lower than 1024, issue the following command:

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Note: If you don’t know the location of node, follow below command.

sudo setcap 'cap_net_bind_service=+ep' `which node`

Leave a Comment