How to Install Node.js on Windows: The Right Way (2024 Guide)
Tech Setup
Reviewed July 23, 2026

Why You Should Avoid the "Official" Installer
If you head over to nodejs.org and download the .msi installer, you are setting yourself up for friction. The standard installer places Node and npm into a system-wide directory. While this works for "Hello World" scripts, it becomes a nightmare for professional development for three specific reasons:
- Permission Issues: Global packages (like
nodemonortypescript) often require administrator privileges to install or update when using the default directory. Running your terminal as Admin is a security anti-pattern. - Versioning Constraints: If you are a consultant or a full-stack developer, you will eventually work on a legacy project requiring Node 16 and a modern project requiring Node 20 or 22. The official installer forces a single version globally.
- Path Pollution: Managing your system
PATHmanually is brittle. When you inevitably need to switch versions, manually editing environment variables is a recipe for broken builds.
The "right way" to handle Node.js on Windows in 2024 is to use a Version Manager. For Windows developers, the gold standard is nvm-windows.
Prerequisites: Cleaning the Slate
Before we install anything, we must ensure your environment is clean. If you have previously installed Node.js via the .msi file:
- Open Control Panel > Programs and Features.
- Search for Node.js and uninstall it.
- Open File Explorer and check
C:\Program Files\nodejsandC:\Program Files\npm. Delete these folders if they still exist. - Open your terminal (PowerShell or Windows Terminal) and run
node -v. If it returns a version, check your System Environment Variables and remove any paths pointing to Node.
Step 1: Installing nvm-windows
nvm-windows is a lightweight utility that allows you to install and switch between multiple versions of Node.js with a single command.
- Navigate to the nvm-windows GitHub releases page.
- Download the
nvm-setup.exefile. - Run the installer. Accept the default settings (it will create a symlink folder, usually at
C:\nvm). - Once finished, open a new terminal window (this is crucial for environment variables to refresh).
Verify the installation by running:
nvm version
Step 2: Installing Node.js Versions
Now that nvm is active, you don't need to touch the Node.js website anymore. You can pull any version directly from your terminal.
The LTS (Long Term Support) Version
For professional work, you should almost always use the latest LTS release. It provides the best balance of stability and access to modern JavaScript features.
nvm install lts
nvm use lts
Specific Versions
If you are working on a legacy codebase, you can specify an exact version:
nvm install 18.17.0
nvm use 18.17.0
To see which versions are currently installed on your machine, run:
nvm list
Step 3: Configuring npm (The Better Way)
By default, npm installs global packages in a location that can be tricky to manage. To keep your system clean, we want to ensure npm respects our version-managed environment.
When you install Node via nvm, npm is bundled automatically. You don't need to install it separately. However, you should check your prefix settings to ensure global modules are stored in your user profile:
npm config list
If you ever run into "access denied" errors when running npm install -g <package>, the fix is to change the global path to a folder in your User directory, or simply use npx to run binaries without installing them globally.
Step 4: Integrating with Windows Subsystem for Linux (WSL2)
If you are a Tier-1 developer, you are likely using (or should be using) WSL2. Note: If you use WSL2, do not use nvm-windows inside the Linux distribution.
WSL2 is essentially a separate Linux machine. The Node.js ecosystem in Linux handles version management differently.
- Open your WSL2 terminal (e.g., Ubuntu).
- Install
nvm(the standard Linux version, not the Windows one):curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash - Restart your terminal and install Node:
nvm install --lts
Why this matters: Development tools like Docker, build scripts, and native C++ modules often compile differently on Linux vs. Windows. By using WSL2, you ensure your development environment matches your production environment (usually Linux-based cloud servers).
Essential Developer Tooling: Corepack
In Node.js 16.10+, a tool called corepack was introduced to help manage package managers (yarn, pnpm, bun).
Instead of installing these globally via npm i -g pnpm, which can lead to version conflicts, use Corepack:
corepack enable
Once enabled, you can run corepack prepare pnpm@latest --activate. This allows your projects to define their preferred package manager via the packageManager field in package.json, ensuring the entire team uses the exact same version of the tool.
Troubleshooting Common Issues
1. "nvm command not found"
This happens if your PATH didn't update after installation.
- Search "Edit the system environment variables" in Windows.
- Click Environment Variables.
- Under User variables, find
PATHand ensureC:\nvmandC:\Program Files\nodejsare present.
2. "Execution Policy" Errors
If you are using PowerShell, you might see an error saying "scripts are disabled on this system."
- Run PowerShell as Administrator.
- Execute:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
3. Using VS Code
Ensure your VS Code terminal is set to use PowerShell or Git Bash, not Command Prompt (cmd.exe). Command Prompt lacks the robust features needed for modern Node.js development. You can change this in VS Code by clicking the + icon dropdown in the terminal pane and selecting "Select Default Profile."
Final Best Practices for Tier-1 Developers
- Use .nvmrc: If you are working in a team, include a
.nvmrcfile in the root of your project containing the version (e.g.,20.10.0). When developers enter the folder, they can simply runnvm useto switch to the project-required version instantly. - Avoid Global Packages: Except for CLI tools that you use daily (like
verceloraws-cdk), avoidnpm install -g. Always prefer adding packages todevDependenciesin yourpackage.jsonand running them vianpx. This ensures that your project remains reproducible across different machines. - Update Periodically: Every few months, run
nvm list availableto see if a newer LTS version is out. Upgrading is as simple asnvm install <version>andnvm use <version>.
By following this workflow, you move away from the "it works on my machine" chaos and into a structured, professional development environment that treats your toolchain as code.
Related articles


Setting Up WSL2 with Ubuntu on Windows 11: Dev Guide
