3 ms·
I don't remember exactly what tool does this, but one package manager (can be homebrew but long time ago I used homebrew) warns users if you are running it as r
by diggan 9y ago
I don't remember exactly what tool does this, but one package manager (can be homebrew but long time ago I used homebrew) warns users if you are running it as root, since it should install packages as the user.
I think npm could implement a similar strategy and educate the users how packages should really be installed.
- dharmab 9y agoSeveral Arch Linux AUR helpers (pacaur and trizen, for example) refuse to run as root. Instead, they invoke sudo to escalate only during the necessary phases.
- RX14 9y agoThat's because makepkg rightly refuses to run as root. ==> ERROR: Running makepkg as root is not allowed as it can cause permanent, catastrophic damage to your system.
- Shank 9y agoHomebrew it is! $ sudo brew Error: Running Homebrew as root is extremely dangerous and no longer supported. As Homebrew does not drop privileges on installation you would be giving all build scripts full access to your system.
- nailer 9y agoI really like that message. It used to be something diffr\erent, which was vague, but this actually tells you why it refuses to run as root.
- al2o3cr 9y agoBundler does something similar - it complains if you run the command with sudo. Ignoring the warning can result in exciting permissions errors later, which is what I'm guessing the NPM code is trying to avoid.
- JorgeGT 9y agompirun will also throw an error if run as root: -------------------------------------------------------------------------- mpirun has detected an attempt to run as root. Running at root is strongly discouraged as any mistake (e.g., in defining TMPDIR) or bug can result in catastrophic damage to the OS file system, leaving your system in an unusable state. You can override this protection by adding the --allow-run-as-root option to your cmd line. However, we reiterate our strong advice against doing so - please do so at your own risk. --------------------------------------------------------------------------
- Master_Odin 9y agonpm first needs to fix the issue that by default, if you want to do anything globally, you have to use sudo. Homebrew warns against using sudo, but it's also possible to install things globally without using sudo.