NVM stands for Node Version Manager
It's a small program that sits on your machine and manages multiple Node installations. That's its only job — install Node versions and switch between them.
Life Without NVM
Let's assume we don't know what NVM is, and we install Node on our system. Let's say you installed Node 20 on your system, and it gets installed fine.
Now every project, every command, will use Node 20 — because that's the only version available on your system.
But let's add a twist.
You also install a slightly older version, or another newer version, of Node. Now your system has two versions of Node — one you installed first, and one you installed recently.
So the question is — what happens now? By default, which one gets used in your projects or terminal sessions?
Now things get messy. Your system doesn't have a smart manager like NVM, so there are two possibilities.
Option A
The latest install overrides the old one. It doesn't matter whether you installed the latest version first and then an older one, or the other way around — whichever you installed most recently overrides the one before it. That old version is basically gone from your system now.
Option B
They conflict and break each other. Now your terminal is confused about which one to use, and starts throwing weird errors.
Understanding the Real Problem
When you install Node on your system, it gets installed in a specific path — let's say:
/usr/bin/node → Node 20
That's one location, and it works fine. Whenever you use the node command, under the hood it points to this path:
node command → /usr/bin/node → Node 20 ✅
Everything's good — until you install another Node version. Now you have multiple paths on your system where Node lives. So when you type node, it's confused about where to look. Or in the other case, it just picks the first one it finds — and you can't really control that.
This is exactly the problem NVM solves.
How NVM Solves This Problem
Instead of installing Node into your system folders, NVM uses its own isolated folders to install different versions of Node. Inside NVM's isolated folders, the different versions never touch each other — no conflicts, nothing.
NVM entirely controls the PATH. When you run nvm use 16, it points your PATH to the folder that has Node 16 installed — and vice versa.
That's the whole solution: isolated folders, and PATH control.
Setting Up NVM on Linux
Step 1 — Install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
Step 2 — Reload the terminal
source ~/.bashrc
Step 3 — Verify the version
nvm --version
Step 4 — Install the Node versions you want
nvm install 16.20.2
nvm install 20
Step 5 — Set the default Node version for your machine
nvm alias default 16.20.2
Summary
NVM solves the conflict problem by keeping every Node version in its own isolated folder, and letting you control which one your terminal uses by updating the PATH. Linux uses the original NVM, installed via curl. Windows uses nvm-windows, installed via an exe file. The commands are almost identical on both.
