Thanks to John Papa: https://johnpapa.net/how-to-use-npm-global-without-sudo-on-osx/
- Pre-requisites: npm should be installed
2. make a directory:
mkdir ~/.npm-global
3. tell npm where to find/install global packages
npm config set prefix ~/.npm-global
Extra step so that it’s available in the environment variable:
Update bash profile (in *nx or mac) – update or create ~/.bash_profile:
NPM_PACKAGES=~/.npm_global/bin
PATH=”$NPM_PACKAGES:${PATH}”
export PATH