Installing and managing Node versions with n
October 26, 2015
We’ll be using the Z shell (zsh) instead of bash. Replace any reference to .zshrc
with .bash_profile/.bashrc
in case you are running on bash instead.
Install NPM
Create a directory for your global packages.
Add a reference to the directory into zshrc
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:
Install n
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!