npm should never interact with hardware, it's job is to install and manage packages. I could understand that you have to run nodejs with root, since it actually can use the hardware.
But using npm with root user? I can't think of a single usecase.
But using npm with root user? I can't think of a single usecase.
A webserver is one of many things that can be run using Node+JS, the point being that it's an entire runtime and can do pretty much anything any other language can do.
Instead of running `sudo npm start`, have `scripts.start` have the value `sudo node index.js` if you want.
But then again, I'm not "most folks", I try to think when I am the root user and don't run third-party code willy-nilly when I am.