nvm on Windows
Problem Statement
You're trying to install Node Version Manager (nvm) on Windows using a command from Unix/Linux documentation:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
This results in errors like:
The system cannot find the path specified.
curl: (23) Failure writing output to destination
The issue occurs because the standard nvm doesn't support Windows. This installation method uses Unix-specific tools (curl
, bash
) that aren't compatible with Windows command prompt. Trying to run Linux/macOS commands on Windows causes the "path not found" and output destination errors.
Solution: Use nvm-windows
For Windows, you need nvm-windows, a separate project that provides similar functionality. Follow this installation process:
Step 1: Uninstall Existing Node.js
- Go to Control Panel → Programs → Uninstall a program
- Uninstall all existing Node.js versions
- Delete any residual Node.js folders (typically in
C:\Program Files\nodejs\
)
WARNING
Skipping this step may cause conflicts between nvm-managed Node.js versions and your existing installation.
Step 2: Download nvm-windows Installer
- Visit the official nvm-windows releases page
- Download the latest
nvm-setup.exe
file
Step 3: Run the Installer
- Right-click
nvm-setup.exe
and select "Run as administrator" - Accept the license agreement
- Set installation location (default
C:\Users\<user>\AppData\Roaming\nvm
is recommended) - Specify Node.js symlink location (default
C:\Program Files\nodejs
)
Step 4: Verify Installation
Open a new command prompt and check the version:
nvm version
You should see your installed nvm-windows version (e.g. 1.1.12
).
Basic Usage
After installation, manage Node.js versions with these commands:
:: Install a specific Node.js version
nvm install 18.18.2
:: Use a version
nvm use 18.18.2
:: Set default Node.js version
nvm use 20.11.1 --default
:: List installed versions
nvm list
:: List available remote versions
nvm list available
:: Uninstall a version
nvm uninstall 16.20.2
Common Issues
1. Access Denied Errors
Run all nvm
commands in administrator command prompt:
- Search for "cmd"
- Right-click Command Prompt → "Run as administrator"
2. Command Not Recognized
After installation:
- Close ALL command prompt and terminal windows
- Open a new administrative terminal and try again
3. Node.js Not Working After Installation
Run this after nvm install
:
nvm on
Best Practices
- Always install Node.js via
nvm install
- not with standalone installers - Use LTS versions for production work:
nvm install --lts
- Use odd-numbered versions for testing new features
- Set a default with
nvm use <version> --default
Alternative Management Tools
- nvs (Node Version Switcher): Cross-platform alternative
- fnm (Fast Node Manager): Faster with Rust implementation
- Volta: Version manager with direct project support
TIP
nvm-windows doesn't support shell commands like nvm run
or nvm exec
. Use explicit Node commands:
node app.js
Conclusion
For Windows environments, use nvm-windows (coreybutler/nvm-windows
) instead of the Unix-only nvm-sh/nvm
. Follow these key steps:
- Uninstall existing Node.js
- Download
nvm-setup.exe
from the official releases - Install as administrator
- Verify with
nvm version
- Install and manage Node.js versions through nvm commands
With nvm-windows, you can seamlessly switch between Node versions without reinstalling or manual path adjustments.