Ever cloned a project only to realize it needs a different Node version than what you have installed? That's exactly why nvm exists.
What is nvm?
nvm (Node Version Manager) lets you install and switch between multiple Node.js versions on the same machine. No more uninstalling and reinstalling Node every time you switch projects.
Quick Setup
macOS/Linux:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc # or ~/.zshrc
Windows: Download nvm-windows from the official GitHub releases.
Essential Commands
# Install specific version
nvm install 18.17.0
# Install latest LTS
nvm install --lts
# Switch versions
nvm use 18.17.0
# List installed versions
nvm ls
# Set default
nvm alias default 18.17.0
The Real Power: .nvmrc Files
Create a .nvmrc file in your project root:
18.17.0
Now just run nvm use in that directory, and it automatically switches to the right version. No more guessing which Node version the project needs.
Common Gotcha
Global npm packages are tied to each Node version. Install TypeScript on Node 18, switch to Node 20, and you'll need to reinstall it. This prevents version conflicts but can be surprising at first.
Tip: Use npx instead of global installs when possible:
npx create-react-app my-app
When You Shouldn't Use nvm
nvm is perfect for development but not ideal for production servers. For production, use Docker with pinned Node versions or system package managers.
Worth Checking Out
If you want something faster, look at fnm (written in Rust) or volta (made by LinkedIn). Both solve the same problem with better performance.
nvm is one of those tools that seems optional until you actually need it. Once you're juggling multiple projects with different Node requirements, it becomes essential.
Want a deeper dive? Check out my complete guide with troubleshooting tips, automation tricks, and advanced usage patterns: Full nvm Guide: Everything You Need to Know
What's your preferred way to manage Node versions? Let me know in the comments!
Top comments (0)