Categories
Tags
Astro Camping CLI Codex Component Design Configuration Copilot CUDA Cursor Day Trip Dynamic Routing Editor Error Error Fix Error Handling Gemini git GitHub GitHub Copilot Google Hiking Hot Springs Installation Iwate Prefecture Kobe Mac Meteor Shower Nara Prefecture NoAdapterInstalled Node.js nvm OpenAI params props Redirect SEO Stargazing Static Site Student Visual Studio VS Code VS2026 Windows
187 words
1 minutes
Fastest Way to Install Node.js 22 with nvm on Mac
Table of Contents
Why nvm?
- Instant switching: Use
nvm use 22or.nvmrcto lock versions per project. - No sudo needed: Installs in user space, keeping your system Node clean.
- Reproducible: Share
.nvmrcso everyone uses the same Node version.
Installation Steps
1) Install nvm (Official Installer)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bashCheck GitHub for the latest command.
After installation, verify initialization in ~/.zshrc. If missing, add:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"Then reload:
source ~/.zshrcTo check for hidden files:
ls -a
2) Install and Use Node.js 22
nvm install 22
nvm use 22
node -v # v22.x
npm -v # 10.x+(Optional) Set 22 as default:
nvm alias default 223) Lock Version Per Project
echo "22" > .nvmrc
nvm use # Automatically selects v22 in this directoryCommon Issues
nvm: command not found→ Check~/.zshrcinitialization and runsource ~/.zshrc.- Not switching to v22 → Run
which nodeto see if Homebrew’s Node takes priority. If needed,brew uninstall node. - Global npm not working → Verify
npm prefix -gbin is in PATH (only if needed).
Final Notes
It would be easier if Homebrew installation worked, but nvm doesn’t seem to support it. Manual setup is a bit tedious, but it’s the way to go.
Fastest Way to Install Node.js 22 with nvm on Mac
https://naonao-na.com/en/posts/nodejs-install-nvm-mac/
