How to change default node version using NVM?

nvm (Node Version Manager) is a tool that allows us to download and install Node.js. It is a very handy tool to manage Node.js.

We can easily check we have nvm installed or not by using following command:

$ nvm -v
0.38.0

If we have nvm installed, we can then get installed node version by using this command:

$ nvm list
->       v14.17.6
         v16.9.1
         system
default -> v14.17.6
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v16.9.1) (default)
stable -> 16.9 (-> v16.9.1) (default)

From the above list, we have our node version 14.17.6 as default. We wanted to move to v16.9.1 stale version of node. We were able to do it using the nvm alias command like below:

$ nvm alias default 16.9.1
Reference: