1

im facing this problem where im trying to start a server on port 80 of a Macbook Pro with MacOS Big Sur and im getting permission denied.

I tried running with sudo and also doing "sudo su" and then running the server.

I'm trying running a Nuxt (node js) server

$ sudo npm run dev
Error: listen EACCES: permission denied 127.0.0.1:80

Should i unlock something?

4
  • How do you start your server (exact command), where do you get the error message?
    – nohillside
    Feb 10 at 12:23
  • Im running "sudo npm run dev" and im getting "Error: listen EACCES: permission denied 127.0.0.1:80" Feb 10 at 14:18
  • Is something else already running on port 80? Does it work if you use a higher port above 1024?
    – nohillside
    Feb 10 at 14:36
  • With port 1000 for ex, i get the same permission denied and with port 1025 it works perfect Feb 10 at 23:45
0

No, everything is working as intended. You need sudo to have a command line process listen on low ports. There’s nothing you want to unlock here as this is a protective feature.

I usually just test on ports higher than 1024 to avoid this risk entirely until it’s time to write a proper wrapper script, but all three options are just as suitable. (Use sudo, use setuid permissions, change the port listen number)

To use sudo - run a shell first, then the npm command

sudo -s
npm run dev
exit
3
  • The issue is that im running the server with sudo. Thats why im asking Feb 10 at 14:16
  • You can’t sudo the npm ince that calls another process - try sudo -s followed by the npm command @FaustoSanchez
    – bmike
    Feb 10 at 14:47
  • I get the same error with that command Feb 10 at 23:45
0

For years I have been running a local node.js server on port 80 with

sudo npm run

After upgrading npm to 7.6.3 from 6.14.11 i also get a permission denied error. The error disappeared after downgrading back to 6.14.11.

No sure if this was an intended change to run node on a port below 1024.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .