

This will switch not only the Node but also the NPM version as well. For example, if you want to switch to Node version 16.20.0 from the current one then the command will be: nvm use 16.20.0 Here, ‘version_number‘ refers to the version of the Node version you want to use. The command syntax is: nvm use version_number Once you have installed multiple versions of Node.js you can use the following command to switch between them. Note: To list all the Node versions even those are not compliant with LTS, the command will be nvm ls-remoteįor that, the command is: nvm install node-versionįor example, to get the node version – 16.20.0, nvm install 16.20.0 The versions in the red color of Node are not on your system, so if you want to use any of them on your system then you first need to install the same. Now, you can list available LTS versions to use with NVM nvm ls Let’s check first our system Node version: node -v

However, by default NVM will not be on your system, to install it run: curl | bash Those who want to switch the Node version and use the corresponding version of NPM available for it can use the NVM (Node Version Manager) tool that facilitates us with a command to switch between different versions of Node.js and NPM.

Now, if we want to get back the previous version that we have changed, we need to install it using the same command.įor example, we switch to NPM 6.14.5 and now want to go back to 9.5.0, then we use: npm install -g NVM Usage to switch Node version. You can see in the previous step we have successfully changed the current NPM version to what want. Step 4: Switch back to the previous NPM version This will display the newly installed version of NPM. In the above-given syntax, replace the ‘version_number‘ text with the exact version of NPM you want to install on your system.įor example, our current version is 9.5.0 but we need 6.14.5 for our project then to install it, we can use the “NPM Install” command in this way: npm install -g : -g stands for global, if you want to install the new version only for your current project then switch to its directory and run the command but without -g Step 3: Verify the new NPM versionĪfter successfully installing the NPM required version, we can check whether it has been set as the default current version or not. If you want to have some other version of NPM than the one currently installed on your system then you need to install it manually, here is the command syntax to do that. The above command will display the current NPM version installed on your system. To do that on your PC – Windows, Linux, or macOS open the command terminal, and after that run the given command. You should know the current version of NPM installed on your system before issuing any command to change it.

Conclusion Step 1: Check the current NPM version
