Updating software is painful and often causes problems. We all prefer using stable versions, but sometimes there’s a need to install different version. From my experience the there are three main reasons why we do that: because current version causes troubles, to test something under different version or… out of pure curiosity. Let’s see how we can manage different version of Node using NVM – Node Version Manager.
NVM lets us install several versions of Node and mange them depending of our needs. Managing means that we can easily switch between versions “on-the-fly”. How cool is that?
Let’s start from the scratch. Installation process is very simple. I was able to install nvm under macOS Sierra 10.2:
- Download bash script that will install nvm on your machine and run it
install scriptAlternatively run this command straight from you terminal:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
- To check if everything was installed correctly, run:
nvm --version
- You should receive current version of nvm. In my case it was
0.32.0
- Now we can install available versions of Node:
nvm ls-remote
- To narrow list to only show LTS versions, we can type:
nvm ls-remote --lts
- After that we can install latest version. For it is node v.4.6.0
nvm install v4.6.0
- That’s it. Hopefully you were able to install both nvm and node without any problems.