2

When running npm start showing this permission issue.

 Error: listen EACCES: permission denied 0.0.0.0:443
    at Server.setupListenHandle [as _listen2] (node:net:1302:21)
    at listenInCluster (node:net:1367:12)
    at Server.listen (node:net:1454:7)
MUHAMMAD SHAHID RAFI C P
  • 1,067
  • 1
  • 12
  • 25

1 Answers1

8

Running server with npm on https port 443 was fine with sudo. Until I had to upgrade npm (from v6 to v8). And googling initially didn't help, because everyone is suggesting sudo.

Found duplicate answer here. Referring to another site.

A lot of people get stuck here, but the solution is easy. There a few options but this is the one I like. Type the following commands:

sudo apt-get install libcap2-bin 
sudo setcap cap_net_bind_service=+ep `readlink -f \`which node\`` 

Now, when you tell a Node application that you want it to run on port 80, it will not complain.

Zmogas
  • 1,115
  • 1
  • 14
  • 15
  • This is also a very typical issue when running servers inside a WSL Linux distro. Thank you – Greg Feb 22 '23 at 19:49