"Please try running this command again as Root/Administrator" error when trying to install LESS "Please try running this command again as Root/Administrator" error when trying to install LESS node.js node.js

"Please try running this command again as Root/Administrator" error when trying to install LESS


Re Explosion Pills "An installation can run arbitrary scripts and running it with sudo can be extremely dangerous!"

Seems like using sudo is the wrong way of doing it.

"Change the owner of the files in your /usr/local folder to the current user:"

sudo chown -R $USER /usr/local

Then run the install

node install -g less

Check out:


Honestly this is bad advice from npm. An installation can run arbitrary scripts and running it with sudo can be extremely dangerous! You could do sudo npm install -g less to install it globally, but instead I would recommend updating your npm settings:

#~/.npmrcprefix=~/.npm_modules

Then you can update your path:

#~/.bashrc or ~/.zshrc, etc.export PATH=$PATH:$HOME/.npm_modules/bin

Then you don't require root permissions to perform the installation and you can still use the binary.

This would only apply to your user, however. If you want the entire system to be able to use the module you would have to tell everyone to add your path. More complicated and robust solutions would include adding a folder with node modules / binaries that a group could install to and adding that to everyone's path.


Just prepend sudo to the beginning of your command.As stated before, an installation runs some scripts that might be dangerous but I saw installing globally helps a lot and is way simpler.

Run sudo npm install -g less