Set default node version using nvm

René Kulik on 01.05.2019

I recently faced an issue switching node versions by using the Node Version Manager (nvm). I wanted to upgrade node from version 8.9.4 to version 10.13.0. I did that by running the following commands:

$ nvm install 10.13.0
$ nvm use 10.13.0

node -v confirmed that I successfully switched to 10.13.0, but when I opened a new terminal window the version change was not handed over and node was still on 8.9.4.

As I found out, that was because I also had to set the default node version on the shell:

$ nvm alias default 10.13.0

This command did the trick and node was using the correct version even in new terminal instances.

I hope this post helps you if you are having the same issue.