How do I run terminal in sudo mode? I was trying to install npm, and I got

npm ERR! Error: EACCES, Permission denied '/usr/local/lib/node_modules'
npm ERR! 
npm ERR! Please use 'sudo' or log in as root to run this command.
npm ERR! 
npm ERR!     sudo npm "install" "." "--force" "--global"
npm ERR! 
npm ERR! or set the 'unsafe-perm' config var to true.
npm ERR! 
npm ERR!     npm config set unsafe-perm true


How can log in as a root?
sudo -s is far easier than enabling the root user since it just starts up a shell with root permissions as a one step, on demand action. Not only is it fast, but it doesn't need to be reconfigured when you don't need the root user and doesn't expose the server to any more risk or vulnerability that adding a root user would entail.

Of course for npm you could just follow the directions and type:

sudo -H npm "install" "." "--force" "--global"


That still makes the npm command "root" and skips the log out step to get back out of root.