Lately I've been working on some projects that aren't compatible with the latest Node version (8.x), so I figured I'd document the
nvm tool that I've been using to switch between versions.
nvm allows us to have (and use) multiple versions of Node on the same machine and we can switch the version with ease. Let's install
We can install via cURL by running the following in our terminal:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
nvm, I first check the version number of my current Node installation with
node -v, this comes back as 8.4.0, as expected. As I'm looking to work with the Ghost CLI, I'll need to change this to 6.5.0:
To install Node v 6.5.0 we can run:
nvm install 6.5.0
This then automatically switches our version of Node to 6.5.0, allowing us to perform any actions that require this version of Node. Another way to do this is by using
nvm use <version-number>, and finding those version numbers is as simple as
We can therefore switch between installed versions with the above.
If you no longer need to use
nvm or specific versions of Node, you can restore the PATH with