Node version manager overview
Node.js projects often depend on a specific major version. One project may expect Node 22, another may expect Node 24, and a new experiment may be testing Node 26 Current.
A version manager lets you:
- Install multiple Node versions side by side
- Switch versions per project
- Avoid global permission problems
- Keep old projects working
- Test new Node versions safely
- Match CI, Docker, or production runtime versions
- Avoid breaking global npm packages during upgrades
Direct installers from nodejs.org are fine for simple use, but they often create friction later. The common problems are PATH conflicts, global npm permission errors, and not knowing which project changed your runtime.
For serious development, use a version manager.
fnm vs nvm vs nvm-windows
fnm
fnm stands for Fast Node Manager. It is modern, cross-platform, and works well on Windows, macOS, and Linux.
Choose fnm if:
- You want one manager across operating systems.
- You use PowerShell, zsh, bash, fish, or WSL.
- You want quick shell startup.
- You want automatic version switching with
.node-versionor.nvmrc.
nvm
nvm is the traditional Node Version Manager for macOS, Linux, and WSL. It is widely used and heavily documented.
Choose nvm if:
- Your team already uses it.
- Your project docs assume
nvm. - You work mostly in macOS, Linux, or WSL.
Do not install the Unix nvm directly into normal Windows PowerShell. Use nvm-windows or fnm for native Windows.
nvm-windows
nvm-windows is a separate project for Windows. It is not the same codebase as Unix nvm, but it provides similar version switching.
Choose nvm-windows if:
- You are on Windows.
- You want a simple
nvm installandnvm useworkflow. - Your team already documents
nvm-windows.
For most new Windows setups, fnm is the cleaner default.
Step-by-step setup
Quick requirements
Before you start, use a supported Windows, macOS, Linux, or WSL environment, a terminal, permission to install developer tools, and a normal user account rather than root/admin for day-to-day Node work. Plan 10 to 30 minutes for a clean install, or longer if an older Node install is already conflicting with your PATH.
Before you install: clean up old Node conflicts
If you already installed Node.js directly, your PATH may point to the old installer.
Check what is currently active.
Windows PowerShell:
where.exe node
where.exe npm
node -v
npm -v
macOS or Linux:
which node
which npm
node -v
npm -v
If you see a direct installer path and want a clean version-manager setup, uninstall the old Node.js installation first:
- Windows: Settings > Apps > Installed apps > Node.js > Uninstall.
- macOS package installer: remove the package according to your team's policy, or prefer a fresh shell PATH controlled by the version manager.
- Homebrew Node: use
brew uninstall nodeif you installed Node through Homebrew and no longer want that path.
Do not delete project node_modules folders unless you are intentionally reinstalling dependencies.
Recommended path: install fnm on Windows
Open PowerShell.
Install fnm with Windows Package Manager:
winget install Schniz.fnm
Close and reopen PowerShell. Then verify:
fnm --version
Add fnm to your PowerShell profile:
if (!(Test-Path $PROFILE)) { New-Item -ItemType File -Path $PROFILE -Force }
notepad $PROFILE
Add this line to the profile:
fnm env --use-on-cd | Out-String | Invoke-Expression
Save, close, and restart PowerShell.
Install Node.js LTS:
fnm install 24
fnm use 24
node -v
npm -v
Set it as your default if your fnm version supports the default command:
fnm default 24
If your shell does not pick up Node after installing, close every terminal window and open a new one.
Install fnm on macOS
If you use Homebrew:
brew install fnm
Add fnm to your shell profile.
For zsh, which is the default shell on modern macOS:
echo 'eval "$(fnm env --use-on-cd)"' >> ~/.zshrc
source ~/.zshrc
Install Node.js LTS:
fnm install 24
fnm use 24
node -v
npm -v
If node is still not found, restart Terminal and run:
fnm env
That output shows what your shell profile needs to load.
Install fnm on Linux
Install with the official install script:
curl -fsSL https://fnm.vercel.app/install | bash
For bash, add this to ~/.bashrc:
eval "$(fnm env --use-on-cd)"
Reload:
source ~/.bashrc
For zsh, add it to ~/.zshrc:
eval "$(fnm env --use-on-cd)"
Then:
source ~/.zshrc
Install Node.js LTS:
fnm install 24
fnm use 24
node -v
npm -v
Alternative: install nvm on macOS, Linux, or WSL
Use Unix nvm when your project or team already expects it.
Install:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
Close and reopen the terminal, or load it manually:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
Install the current LTS:
nvm install --lts
nvm use --lts
nvm alias default 'lts/*'
Verify:
node -v
npm -v
If nvm is not found after installation, open a new terminal. If it still fails, inspect ~/.bashrc, ~/.zshrc, or your shell's actual startup file to make sure the installer added the NVM_DIR block.
Alternative: install nvm-windows
Use nvm-windows only on native Windows. It is not the same as Unix nvm.
Install with winget:
winget install CoreyButler.NVMforWindows
Close and reopen PowerShell.
Install Node.js LTS:
nvm install 24
nvm use 24
node -v
npm -v
If node still points to an old install, run:
where.exe node
where.exe npm
Then uninstall old Node.js entries from Windows settings and restart the terminal.
Use .node-version or .nvmrc per project
Version files prevent accidental runtime drift.
For fnm, create either:
.node-version
or:
.nvmrc
Example content:
24
When fnm env --use-on-cd is loaded, entering the folder can switch versions automatically.
For nvm, create .nvmrc:
24
Then run:
nvm use
If the version is missing:
nvm install
Use version files in repos where multiple developers, CI jobs, or Docker images must match the same runtime line.
npm, npx, corepack, pnpm, and yarn
Node.js includes npm. You usually do not install npm separately.
Check:
node -v
npm -v
npx -v
For package managers like pnpm or Yarn, modern Node versions include Corepack, which can manage package manager shims.
Enable Corepack:
corepack enable
Then use the package manager defined by the project:
pnpm -v
yarn -v
Do not globally install every package manager unless your workflow needs it. Let the project decide when possible.
Verify it works
Install and run a test script
Create a file named hello-node.js:
console.log("Node is working");
console.log(process.version);
Run it:
node hello-node.js
Expected output:
Node is working
v24.x.x
The exact patch version can vary.
Common problems
node is not recognized on Windows
Restart PowerShell first. If it still fails:
fnm --version
where.exe fnm
where.exe node
Make sure your PowerShell profile contains:
fnm env --use-on-cd | Out-String | Invoke-Expression
Then restart the terminal again.
PowerShell blocks scripts
If PowerShell blocks profile loading or scripts, check your execution policy:
Get-ExecutionPolicy -List
For a normal developer machine, you may set the current user policy:
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
Use your organization's policy if this is a managed device.
nvm command not found
Open a new terminal. If it still fails, confirm the shell profile contains the NVM_DIR block:
grep NVM_DIR ~/.zshrc ~/.bashrc ~/.profile 2>/dev/null
Then source the profile you actually use:
source ~/.zshrc
or:
source ~/.bashrc
npm EACCES permission errors
This usually happens when Node or npm was installed globally with system permissions.
Avoid fixing it by repeatedly using sudo npm install -g. That often makes the mess worse.
Better options:
- Use
fnm,nvm, ornvm-windows. - Reinstall the global package after switching to the managed Node version.
- Keep project tools local in
devDependenciesand run them throughnpm scriptsornpx.
Check where npm installs global packages:
npm config get prefix
With a version manager, it should point into the manager's controlled directory, not a system path like /usr/local unless you intentionally configured that.
Wrong Node version inside VS Code
VS Code integrated terminals inherit their environment when VS Code starts.
Fix:
- Close all VS Code windows.
- Open a fresh terminal.
- Confirm
node -v. - Start VS Code from that terminal:
code .
On Windows, also make sure your PowerShell profile is loading in the integrated terminal.
Project installs fail after switching Node versions
Delete and reinstall project dependencies when the Node major version changes:
rm -rf node_modules package-lock.json
npm install
On Windows PowerShell:
Remove-Item -Recurse -Force node_modules
Remove-Item package-lock.json
npm install
Only remove the lockfile when you intentionally want to refresh dependency resolution. In team projects, check with the project convention first.
Recommended setup for local AI and automation tools
For tools like OpenClaw, n8n development, custom APIs, frontend apps, MCP servers, or local automation scripts:
- Use Node.js 24 LTS unless the project documents another version.
- Put a
.node-versionor.nvmrcfile in each project. - Use local project dependencies instead of global installs where possible.
- Keep Docker, PostgreSQL, and Node versions documented together.
- Do not mix
fnm,nvm,nvm-windows, Homebrew Node, and direct installers on one shell PATH.
One version manager is enough.
Bottom line
Install Node.js with fnm if you want the cleanest modern setup across Windows, macOS, and Linux. Use Unix nvm when a macOS/Linux/WSL project already expects it. Use nvm-windows only for native Windows workflows that specifically prefer it.
Install the current LTS line, verify node -v and npm -v, and use a project version file so your local runtime stays predictable.