0

I have a node.js Express backend API application and we use yarn and pm2.

I know the version has been upgraded from node 11 to node 12 so I installed 12 using nvm install 12

When I update the sourcecode via git and do yarn start, there is an error saying it does not have the permission to run the application on port 80. Just out of curiosity I switched back to node 11 using nvm, and run yarn start without changing any source code or config, and the application started.

Does anyone has pointers as to why Node 12 does not seem to have permission required to start a service on port 80 , while node 11 could?

If this is related to the way I installed node 12 using nvm install 12, can someone point me to the right resources where I can understand more about nvm's encapsulation and permission settings ? thanks.

EDIT : As a workaround as Lawrence suggested, I reroute it to run on 8080. Back to the core of the question, why does Node 11 has permission , but Node 12 does not have the permission required to run on port 80?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Gapton
  • 2,044
  • 2
  • 20
  • 33
  • it shouldn't have worked on 11, maybe you installed node 11 with root, ports below 1024 are privileged and always have been and require root user to run a service on them, you should look into installing nginx and forwarding 80 to 8080 or such, its never a good idea to do `sudo node index.js` etc to overcome this issue or run node as root – Lawrence Cherone Nov 09 '20 at 03:30
  • Does this answer your question? [How do I run Node.js on port 80?](https://stackoverflow.com/questions/6109089/how-do-i-run-node-js-on-port-80) – Lawrence Cherone Nov 09 '20 at 03:30
  • Yes I do understand it is common to do it via iptable and route 8080 to 80 (or some other ports). I also understand what worked in 11 should not worked in 12 since its a major version change. But I am trying to figure out why was it complaining about permission in the first place. – Gapton Nov 09 '20 at 03:34

0 Answers0