by Sai gowtham

Setting a default Node version in nvm

In this tutorial, we are going to learn about how to set a default node version in the nvm manager.

If you install multiple node.js versions using the nvm (node version manager), you can use one of the installed versions by using the following command.

nvm use v10.14.1

Now, when you close the terminal and open a new one nvm forgets your node command and prints the following error in your terminal.

➜  ~ node -v
zsh: command not found: node

To fix this, you need to set a default node version using:

nvm alias default 10.14.1

Here 10.14.1 is my node version number (in your case it will be different) and it persists the change even after closing the terminal.

You can also view the installed node versions like this.

nvm list

output:

$ nvm list
         v8.0.0
->       v10.14.1
         system

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
45,614 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
284,472 students enrolled
40 hours of video content
View Course
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
130,921 students enrolled
48.5 hours of video content
View Course