Run node.js on port less than 1024 without sudo

On Ubuntu

Normally, to run a program that bind to port less than 1024, it needs to be run as sudo. But not anymore, we can use this solution:

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

After this, we can run node normally without sudo but still can bind to port 443 etc.

Why not just run as sudo?

Because nvm is per-user, per-shell. And running node as root is not a good practice.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.