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