How-To Guide
How to Update Node.js
Updating Node.js is essential for security patches, new features, and package compatibility. Here's how to do it on any OS in under 10 minutes.
Quick answer: If you have nvm installed, run nvm install --lts && nvm use --lts. On macOS with Homebrew, run brew upgrade node. Otherwise, download the latest LTS installer from nodejs.org.
📋 Before You Update
- Check your current version:
node --version - Know your target: LTS (stable) or Current (newest features)
- Save your work — some tools may need reinstalling after
✅ Rule: Always update to the LTS version unless you need a specific feature from Current.
Method A — Using nvm (Recommended)
nvm (Node Version Manager) is the best way to update Node because it lets you switch versions freely.
# Install the latest LTS version
nvm install --lts
# Use it as the default
nvm use --lts
nvm alias default lts/*
# Verify
node --version
Don't have nvm? Install it first — see our Install Node.js guide.
Method B — Using npm
If you don't have nvm, you can try updating via npm — but this doesn't always work on all systems.
# Install latest LTS
npm install -g n
sudo n lts
# Or on Windows with npm-windows-upgrade
npm install -g npm-windows-upgrade
npm-windows-upgrade
💡 Note: The npm method may require sudo/admin rights and doesn't work on Windows the same way. Use nvm or the installer instead.
Method C — Using Homebrew (macOS/Linux)
If you installed Node via Homebrew:
brew update
brew upgrade node
# Verify
node --version
Homebrew always gives you the latest LTS version.
Method D — Official Installer
The simplest method if you don't have nvm or Homebrew:
- Go to nodejs.org
- Download the latest LTS installer for your OS
- Run the installer — it will replace the old version automatically
- Restart your terminal
- Run
node --versionto verify
🔧 After Updating — Check These
- npm version:
npm --version— should update with Node - Global packages: Some may need reinstalling. Run
npm list -g --depth=0to see what's installed - Project compatibility: Test your main projects. If they fail, use nvm to switch back to the old version
- Cache issues: Clear npm cache with
npm cache clean --forceif strange errors appear
🚫 Common Mistakes
- Updating to Current instead of LTS. Current versions break more often.
- Updating globally without a version manager. Use nvm to avoid breaking existing projects.
- Forgetting to reinstall global CLI tools. Tools like TypeScript, nodemon, and create-react-app need to be reinstalled after major updates.
- Not testing after update. Always run your test suite and verify critical projects.
❓ Frequently Asked Questions
How do I update Node.js?
;Easiest with nvm: nvm install --lts && nvm use --lts. On macOS with Homebrew: brew upgrade node.
Should I update to the latest version?
Update to the latest LTS version, not Current. LTS is stable and supported for 30 months.
Will updating break my projects?
It might. Each project can pin its own Node version via nvm. Test updates in a dev environment first.
What is the latest Node.js version?
Check nodejs.org for the current LTS. As of 2026, Node 22 is the LTS.