Sometimes it may be necessary to downgrade Node to an older version for compatibility or stability reasons. For example, I faced the “ReferenceError: primordials is not defined” error and one of the solutions is to downgrade from 19.7.0 to 10.23.1. In this article, I will show you how to downgrade the Node version in Windows 10 using the NVM(Node Version Manager) utility and keep current Node Js.
Step 1 – Uninstall any existing versions of Node.js
Before installing NVM for Windows, make sure to uninstall any previous versions of Node.js to avoid version conflicts. Additionally, delete any Node.js installation directories that might still exist, such as %ProgramFiles%\nodejs. Keep in mind that NVM’s symlink will not overwrite any existing installation directory, even if it’s empty.
Step 2 – Install nvm-windows
Download the latest nvm-windows install. Especially I used ‘nvm-setup.exe’. The installation process is pretty simple, just follow the steps and after it is done restart the power shell terminal.
Step 3 – Run Powershell and Turn On NVM
After installation is done run Powershell and type ‘nvm on’:
Step 4 – Install Various Node versions
To find list of the previous releases visit this nodejs.org page.
To install various versions use the next command:
nvm install node version number
Here is an example of installing Node.js 14.3.0 and 16.1.0 versions:
Step 5 – Switch Node Version and Other Useful NVM Commands
To switch Node Version use
nvm use :
Here are some of the most common NVM commands with explanations:
nvm version– This command displays the current version of NVM that is installed on your machine.
nvm current– This command displays the currently active Node.js version.
nvm ls– This command lists all the Node.js versions that are currently installed on your machine.
nvm alias– This command creates an alias for a specific Node.js version. For example, nvm alias default 16.14.0 sets the version 16.14.0 as the default version and you can use “default” instead of the version number in other commands.
- nvm uninstall
– This command uninstalls a specific version of Node.js.
nvm --help to view list of commands: