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:

  1. Download bash script that will install nvm on your machine and run it
    install script

    Alternatively run this command straight from you terminal:

    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
  2. To check if everything was installed correctly, run:
    nvm --version
  3. You should receive current version of nvm. In my case it was
    0.32.0
  4. Now we can install available versions of Node:
    nvm ls-remote
  5. To narrow list to only show LTS versions, we can type:
    nvm ls-remote --lts
  6. After that we can install latest version. For it is node v.4.6.0
    nvm install v4.6.0
  7. That’s it. Hopefully you were able to install both nvm and node without any problems.