Skip to main content

Command Palette

Search for a command to run...

Getting Started with NVM (Node Version Manager)

Updated
•4 min read•View as Markdown
S

I am a full-stack developer with 9+ years of experience, passionate about the JavaScript ecosystem. I have a bachelor's degree in computer science. I am most skilled and passionate about Angular and React. I am able to provide meaningful contributions to the design, installation, testing, and maintenance of any type of software system. I like to challenge myself in new roles. I have built and successfully delivered applications in multiple domains. In my free time, I like to write blogs related to software development. I have the pleasure of working on exciting projects across industries. The applications that I developed were scalable, deployable, and maintainable. I have a vision of providing cutting-edge web solutions and services to enterprises. Developed zero-to-one products.

If you’ve ever struggled with switching between different Node.js versions for multiple projects, NVM (Node Version Manager) is the tool that solves it cleanly. Whether you're maintaining legacy apps or working with the latest frameworks, NVM lets you install and switch Node versions in seconds.


🚀 What is NVM?

NVM (Node Version Manager) is a command-line tool that allows you to:

  • Install multiple versions of Node.js

  • Switch between versions per project

  • Avoid global conflicts across projects

  • Test apps across different Node environments


🤔 Why Use NVM?

Without NVM:

  • You’re stuck with one Node version

  • Upgrading/downgrading breaks other projects

  • Global npm packages can conflict

With NVM:

  • Each project can use its own Node version

  • Seamless switching with a single command

  • Clean and isolated development environments


🛠️ Installation Guide

🔹 For macOS / Linux

Run the following command:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

Then reload your terminal or run:

source ~/.bashrc

Verify installation:

nvm --version

🔹 For Windows

Use nvm-windows (a separate implementation):

  1. Download installer from: https://github.com/coreybutler/nvm-windows/releases

  2. Install and open Command Prompt / PowerShell

  3. Verify:

nvm version

📦 Installing Node Versions

Install a specific version:

nvm install 18

Install an older version:

nvm install 10.9.7

🔄 Switching Between Versions

Use a version:

nvm use 18

Switch anytime:

nvm use 10.9.7

📋 List Installed Versions

nvm ls

🌍 Set Default Node Version

To always use a specific version:

nvm alias default 18

🧹 Uninstall a Node Version

nvm uninstall 10.9.7

⚡ Pro Tips

1. Use .nvmrc for Project-Specific Versions

Create a file in your project root:

echo "18" > .nvmrc

Then run:

nvm use

NVM will automatically pick the version.


2. Check Node & npm Versions

node -v
npm -v

3. Avoid Global Package Conflicts

Each Node version has its own global packages—so you won’t break other projects.


⚠️ Common Issues

  • Command not found (nvm) → Restart terminal or source your profile file

  • Permissions issues (Linux/macOS) → Avoid using sudo with npm when using NVM

  • Windows path conflicts → Ensure no existing Node installation is interfering


🧠 When Should You Use NVM?

  • Working on multiple Node.js projects

  • Maintaining legacy applications

  • Testing across Node versions

  • Avoiding dependency conflicts

Conclusion

NVM is an essential tool for any Node.js developer. It gives you flexibility, control, and peace of mind when managing multiple environments. Once you start using it, you’ll never want to go back to a single global Node installation.

You can’t directly “downgrade npm to change Node.js version” — npm and Node are separate. To move from your current setup (npm 11.12.1) to Node 10.9.7, you need to switch Node versions using a version manager.

Also, quick reality check: Node 10.9.7 is extremely outdated (2018, EOL) — many modern packages (including npm 11) won’t work with it. If this is for a legacy project, it’s fine, but don’t use it for anything new.


🔹 On Windows

Use nvm-windows:

  1. Download from: https://github.com/coreybutler/nvm-windows/releases

  2. Install, then run in terminal:

nvm install 10.9.7
nvm use 10.9.7
  1. Verify:
node -v
npm -v

🔹 On macOS / Linux

Install nvm:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

Then:

nvm install 10.9.7
nvm use 10.9.7

⚠️ Important Notes

  • Node 10 comes with npm ~6.x, so your current npm 11.12.1 will automatically downgrade.

  • If npm doesn’t match, you can manually install a compatible version:

npm install -g npm@6

🚨 Compatibility Warning

  • ❌ npm 11 → requires Node 18+

  • ❌ Most modern tools (React, Vite, Angular latest) won’t work on Node 10

  • ✅ Only use for legacy apps


💡 Better Approach (if possible)

If you’re not forced to use Node 10.9.7, consider:

nvm install 18
nvm use 18