NVM (Node Version Manager) is a useful tool for managing multiple versions of Node.js on a single machine. Here's how you can set the default node version using NVM:

First, install NVM if you haven't already. You can follow the installation instructions from the official NVM GitHub repository: https://github.com/nvm-sh/nvm#installing-and-updating

Once you have installed NVM, you can list all the available Node.js versions using the following command:

nvm ls-remote

This command will display a list of available Node.js versions that you can install.

To set a default Node.js version, you can use the following command:
nvm alias default <node_version>


Replace <node_version> with the Node.js version you want to set as the default. For example, to set Node.js version 16.0.0 as the default version, you would use the following command:
nvm alias default 16.0.0

This will set the default Node.js version to 16.0.0. Whenever you open a new terminal session, this version will be automatically selected.

You can verify that the default version has been set by running the following command:
node --version


This will display the version of Node.js that is currently active. If the default version has been set correctly, this should match the version you set in step 3.