Using 'npm install' without Sudo
Npm packages installs should be done without sudo. Infact sudo should be never be used unless tinkering with system wide permissions. Node puts npm packages in a specific folder, usually /usr/local/lib/node_modules. But the trouble is you need sudo permissions to write here. This leads to an endless use of non-requisite sudo permissions. This location is what we need to change and here are handy terminal commands to achieve the same
mkdir ~/.npmnpm config set prefix ~/.npmnano ~/.bashrcexport PATH="$PATH:$HOME/.npm/bin"source ~/.bashrc
Complete guide by NPM can be found here :
For OsX, this is a well written guide:
https://johnpapa.net/how-to-use-npm-global-without-sudo-on-osx/