next.js

Run on port 80

  1. Find the linked Node binary:

    which node
  2. Find the real Node binary:

    readlink -f /run/user/1000/fnm_multishells/2076_1764275467596/bin/node

    You should get something like:

    /home/youruser/.fnm/node-versions/v22.0.0/installation/bin/node
  3. Give that binary permission to bind to low ports:

    sudo setcap 'cap_net_bind_service=+ep' /home/youruser/.fnm/node-versions/vXX.XX.X/installation/bin/node

    (replace the path with what you got from readlink -f)

  4. Verify:

    getcap /home/youruser/.fnm/node-versions/vXX.XX.X/installation/bin/node
    # should output: cap_net_bind_service=ep
  5. Now run Next.js as a normal user:

    PORT=80 npm run dev
    # or
    
    npx next dev -p 80

Notes:

  • If you install a new Node version via fnm, repeat the setcap for that version's node binary.
  • You must run setcap on the actual binary, not the /run/user/... symlink.