We’ll be using the Z shell (zsh) instead of bash. Replace any reference to
.bash_profile/.bashrc in case you are running on bash instead.
Create a directory for your global packages.
Add a reference to the directory into
Tell NPM where to install global packages (in our case ~/.npm-packages)
Install the latest version of NPM
Add the following lines to your .zshrc to be ensure that node will find the packages and that you’ll find the installed binaries:
We’ll install node via n: a Node version management tool. If you have Node installed already via brew, remove it, then:
Install a version of node (ie the latest stable)
To verify if everything installed successfully just run the following commands:
Enjoy! You should now be able to install and manage different node versions on your machine. Check the n documentation!