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:
Then you can update your path:
#~/.bashrc or ~/.zshrc, etc.
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.