blog
Managing and upgrading Node.js versions is indeed a crucial skill for programmers working on multiple projects. The blog talks about primary tools like NVM for macOS/Linux and nvm-windows for Windows users to install, upgrade, downgrade, and uninstall node js versions. The blog also covers additional tips and troubleshooting some common issues to help you ensure the project’s stability and efficient development workflows.
Managing Node.js versions is a crucial skill developers require when working on several projects or staying current with the fast-changing JavaScript world. Different projects may require a specific version of Node.js because of features, compatibility, or performance improvement in newer releases.
This detailed guide explains the primary methods for upgrading or downgrading your Node.js version. The blog also highlights well-known tools like NVM, troubleshooting, and best tips to upgrade and downgrade your node version. Let’s have a look.
Node.js works as an open-source JavaScript runtime that people use for backend work or developing tools. It often gets updates with important features or fixes for security. But sometimes certain libraries, frameworks, or hosting setups need you to use older or very specific versions of Node.js. Being able to switch between different Node.js versions is important to:
First, let’s understand what NVM is.
NVM is a tool you use in the terminal. It lets you manage multiple Node.js versions on your computer. You can install, update, remove, or switch between versions. It helps with:
Launch your terminal and type in the following command.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
or (the latest version may differ):
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
After installation, either restart your terminal or run:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
Verify NVM:
nvm --version
Installing Node.js Versions (Upgrade/Downgrade)
nvm ls-remote
This will output all Node.js versions available for installation.
To install a specific version (e.g., 20.18.0):
nvm install 20.18.0
You can also install the latest LTS version:
nvm install --lts
Or the very latest version:
nvm install node
See all installed versions:
nvm ls
To use a specific version:
nvm use 16.20.2
Or switch by major/minor version if only one matches:
nvm use 14
Set Default Node.js Version
To always start a shell session with a particular Node.js version:
nvm alias default 20.18.0
Uninstall a Node.js Version
To remove unused versions and free space:
nvm uninstall 14.21.3
Upgrading Node.js
Upgrading is just another install/switch:
nvm install 21.0.0
nvm use 21.0.0
nvm alias default 21.0.0
Downgrading Node.js
Downgrading is the same process—just pick an older version:
nvm install 16.20.0
nvm use 16.20.0
Downgrade when a library or project fails with a new Node release.
NVM works as a quick and easy tool to manage Node.js versions on Unix-based systems. It takes up less space compared to nvm but offers fewer settings to adjust.
Check your current version
Run the following command
node –v
Upgrade Node.js version
Install n Globally
npm install -g n
To upgrade to the latest version:
sudo n latest
For the latest LTS:
sudo n lts
For a specific version:
sudo n 18.16.0
Downgrade Node.js Versions (Switch to a Specific Version)
To install specific version:
sudo n 18.16.0
Choose among installed versions:
sudo n
This opens an interactive menu to pick your Node version.
Getting Rid of Old Versions
Use sudo n to open the menu and remove outdated versions you no longer need.
Windows requires a specific version of NVM, called nvm-windows, to manage Node.js versions.
Setting Up nvm-windows
Adding, Updating, or Downgrading Node.js
To upgrade Node.js version 20.18.0:
nvm install 20.18.0
nvm list
nvm use 16.15.1
nvm use 20.18.0
nvm uninstall 14.18.3
Notes
nvm-windows allows you to manage Node and npm. When you change the Node version, it installs a new copy of npm suited to that specific Node.js version.
In 2025, nvm-windows remains a stable and trusted tool, but there are plans to release a "Runtime" tool in the future.
Homebrew (macOS):
brew install node # To install
brew upgrade node # To upgrade
brew uninstall node # To remove
node -v # Verify
Apt (Ubuntu/Debian):
Update with NodeSource (choose your target version, e.g., 20.x):
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install nodejs
nodeVolta
Volta works as a modern tool to manage Node.js and Yarn/npm across different platforms. It keeps track of projects and locks specific versions to each one. This makes it a good choice to meet the needs of diverse teams.
For installing Volta:
curl https://get.volta.sh | bash
Install a specific Node.js version:
volta install node@20.18.0
Pin for a project (from project directory):
volta pin node@20.18.0
Each Node.js version manages a separate global storage for npm packages when using NVM or n. Switching Node.js versions will require reinstalling global tools like Gatsby CLI or nodemon using the following command:
npm install -g your-global-package
To upgrade npm for any Node.js version:
npm install -g npm
npm -v
You can try this method, but it is not the best option:
Permission problems: On Linux or macOS, check if nvm directories have the right permissions. Avoid using sudo too often.
nvm not found: Ensure nvm is sourced in your shell. Add to ~/.bashrc or ~/.zshrc:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
npm issues: Clear the npm cache if packages fail to install:
npm cache clean --force
Issues with PATH: If your terminal says node or npm cannot be found, try restarting it or check if your environment variables are set up.
Some additional tips to consider when upgrading or downgrading node.js versions.
Summary Table
Action | Command Example |
Install nvm |
`curl -o- ... |
Install Node version |
nvm install 18.17.0 |
Use Node version |
nvm use 18.17.0 |
Downgrade |
nvm install 14.21.3 && nvm use 14.21.3 |
See the current version |
node -v |
Set default |
nvm alias default 18.17.0 |
Understanding how to manage Node.js versions is an important skill. Tools like NVM or nvm-windows give you the flexibility you need to switch versions and keep your development up-to-date. You might need to update to newer versions to access features. You might also need older versions to support older systems. Good version management will help your team avoid problems and save time.
Make a habit of clearing out old Node versions that you no longer use. Write down what each project requires and use tools like Volta pinning to keep your team on the same page.
To stay ahead with the latest tools and updates, including new cross-platform managers or tools like Runtime, check the Node.js release blog or other reliable developer sites.
Need professional guidance for your node.js version? Look no further, Lucent Innovation got you covered. Hire node.js developers from us and get the right technical assistance to turn your project into a reality.
One-stop solution for next-gen tech.
Still have Questions?