Backend Development 6 min read

Resolving Node Version Switching Issues with nvm: A Step‑by‑Step Guide

This article walks through diagnosing why nvm use does not change the global Node.js version, explains how multiple Node installations can conflict, and provides a clear step‑by‑step solution—including installing nvm, checking versions, installing and switching targets, and removing stray Node binaries.

Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Resolving Node Version Switching Issues with nvm: A Step‑by‑Step Guide

Earlier I noticed an intern couldn't start a project because the Node.js version was too low, so I suggested using nvm to manage Node versions. While the nvm command reported a successful switch, the global Node version remained unchanged, leading to a deeper investigation.

1️⃣ Install nvm

where nvm

If the nvm path is not found, this command helps locate the default installation directory.

2️⃣ Check the current Node version

The system shows node V16.14.2 as the active version.

3️⃣ Install the target Node version with nvm

Use nvm install <version> to download the required version. After installation, the nvm directory contains folders for each installed Node version.

nvm list

4️⃣ Switch to the target version

nvm use

Running nvm use should select the desired version, but in my case the Node version displayed by node -v stayed at 16.14.2.

5️⃣ Identify the problem

Two separate Node installations existed: the global Node path (pointed to by the system's environment variables) and the Node binary inside nvm's folder. The node -v command was still referencing the global installation, so any nvm switch had no effect.

6️⃣ Solution

Locate the global Node directory with where node and delete it. After removing the stray Node folder, the system points to the nvm‑managed Node binary.

where node

Verify that the path now resolves to the nvm directory, then run nvm use again to confirm the version change.

PS

Instead of manually replacing node_modules , you can try the volta tool for seamless Node version switching without manual file replacement.

backendTroubleshootingNVMVersion Managementnode
Rare Earth Juejin Tech Community
Written by

Rare Earth Juejin Tech Community

Juejin, a tech community that helps developers grow.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.