How to fix npm ERR! 'node' is not recognized as an internal or external command in npm

npmBEGINNERHIGHUpdated Dec 5, 2025· 173 views

This Windows error indicates that Node.js is not in your system PATH, preventing npm and node commands from running. The fix involves adding Node.js to your PATH environment variable or reinstalling Node.js.

Quick fix

Fixes npm ERR! 'node' is not recognized as an internal or external command

node --version
npm --version
  1. Verify Node.js is installed
  2. Add Node.js to system PATH
  3. Resolve PATH variable conflicts
  4. Reinstall Node.js completely
npm — error
node --version
npm --version
npm ERR! 'node' is not recognized as an internal or external command

What this error means

This Windows-specific error indicates that the operating system cannot locate the Node.js executable in the system's PATH environment variable. When you run npm or node commands in Command Prompt or PowerShell, Windows searches a series of directories (defined by the PATH variable) to find the executable. If Node.js was never added to PATH, or if the installation was incomplete or corrupted, Windows reports this error because it cannot find the node.exe file. The npm command itself depends on Node.js, so if the system can't find Node, npm commands will also fail. This is particularly common on Windows because, unlike Unix-like systems, Windows doesn't automatically add application paths to the system environment during installation. You must manually configure PATH or ensure the installer does it correctly during the Node.js installation process.

Typical symptoms

  • Running 'node --version' in Command Prompt or PowerShell returns the error message
  • Running 'npm --version' also produces the same error
  • npm install, npm start, and other npm commands fail immediately
  • The error occurs immediately after a fresh Node.js installation on Windows
  • Visual Studio Code terminal shows the error even though other applications work normally

Common causes

  1. Node.js was never added to system PATH during installation—the installer has an 'Add to PATH' checkbox that may be unchecked
  2. Node.js installation directory path is incorrect in PATH—pointing to a wrong or non-existent directory
  3. User PATH variable conflicts with System PATH variable—if user-level PATH contains an incomplete npm path, it takes precedence
  4. Node.js installation is corrupted or incomplete—the installer may have failed midway
  5. Using nvm-windows without proper PATH configuration
  6. Command prompt was not restarted after PATH changes—old sessions use cached PATH

How to fix "npm ERR! 'node' is not recognized as an internal or external command"

1Verify Node.js is installed

Open Command Prompt (Win + R, type cmd) and check if Node.js exists on your system:

cmd
node --version
npm --version

If both commands fail with the "not recognized" error, proceed to the next step.

You can also verify the installation by checking if the directory exists. Open File Explorer and navigate to C:\Program Files\nodejs. If this folder doesn't exist, Node.js is not installed, and you need to download and install it from https://nodejs.org.

2Add Node.js to system PATH

This is the most common fix. Windows needs to know where to find the node.exe and npm.cmd files:

1. Press Win + R, type systempropertiesadvanced.exe, and press Enter
2. Click the "Environment Variables" button at the bottom
3. Under "System variables" (not User variables), find the variable named Path and click "Edit"
4. Click "New" and add: C:\Program Files\nodejs
5. If you installed Node.js in a different directory, add that path instead
6. Click OK three times to close all dialogs
7. Close all open Command Prompt and PowerShell windows completely
8. Open a new Command Prompt window and test: node --version

The key is closing and reopening your terminal so it reads the updated PATH.

3Resolve PATH variable conflicts

If the previous step didn't work, you may have conflicting PATH entries. Open Environment Variables again and check both "User variables" and "System variables" sections:

1. Look for any entries containing npm, nodejs, or node in either section
2. In the User variables PATH, check if you have: C:\Users\{YourUsername}\AppData\Roaming\npm
3. In the System variables PATH, check if you have: C:\Program Files\nodejs

Important: Both should exist, but they should reference different locations. If you see duplicates or outdated paths (like C:\nodejs or old version directories), remove them.

Correct configuration:
- System PATH: C:\Program Files\nodejs
- User PATH: C:\Users\{YourUsername}\AppData\Roaming\npm (for global npm packages)

4Reinstall Node.js completely

If the above steps don't work, your Node.js installation is likely corrupted. Completely remove and reinstall:

1. Press Win + R, type appwiz.cpl, and press Enter to open Programs and Features
2. Find "Node.js" in the list, click it, and select "Uninstall"
3. Delete the leftover directory: Navigate to C:\Program Files\nodejs and delete it if it still exists
4. Clear npm cache folder: Navigate to C:\Users\{YourUsername}\AppData\Roaming, find the npm and npm-cache folders, and delete them
5. Restart your computer
6. Download the LTS version from https://nodejs.org/
7. Run the installer and ensure "Add to PATH" is checked (it should be by default)
8. Complete the installation
9. Open a new Command Prompt and verify: node --version && npm --version

5Fix Visual Studio Code terminal recognition

If the error appears only in VS Code's terminal but works in standalone Command Prompt, VS Code's terminal hasn't recognized the PATH update:

1. Close Visual Studio Code completely
2. Open a Command Prompt and verify Node.js works: node --version
3. Reopen VS Code
4. Click the terminal area and click the trash/close icon to kill the current terminal
5. Open a new terminal in VS Code (Ctrl + `)

If it still doesn't work, configure VS Code to use a specific shell. Go to VS Code settings, search for terminal.external.windowsExec, and ensure it points to a valid terminal application.

6For nvm-Windows users

If you're using nvm-windows to manage Node versions, the issue may be with how nvm is configured:

bash
# Check if a Node version is active
nvm list

# If no version is active, install and use one
nvm install lts
nvm use lts

# Verify
node --version && npm --version

If you still have issues, uninstall nvm-windows itself, reinstall it, and then install a fresh Node.js version through nvm.

Advanced notes

PATH Resolution Order: Windows searches PATH entries from left to right, stopping at the first match. If you have multiple Node.js installations (old version, nvm, or manual install), PATH order matters. Use where node in Command Prompt to see which node.exe is actually being used.

System vs User PATH: User-level PATH variables take precedence over system-level ones in Windows. This means if you add Node.js to System PATH but it's already (incorrectly) in User PATH, the wrong path will be used. Always check both and remove duplicates or outdated entries.

npm Global Packages: The C:\Users\{username}\AppData\Roaming\npm directory is where globally installed npm packages are stored. This path should also be in your PATH if you want to run global command-line tools directly, but it's separate from the main Node.js PATH.

Frequently asked questions

What does "npm ERR! 'node' is not recognized as an internal or external command" mean?
js executable in the system's PATH environment variable. When you run npm or node commands in Command Prompt or PowerShell, Windows searches a series of directories (defined by the PATH variable) to find the executable. exe file.
How do I fix "npm ERR! 'node' is not recognized as an internal or external command"?
This Windows error indicates that Node.js is not in your system PATH, preventing npm and node commands from running. The fix involves adding Node.js to your PATH environment variable or reinstalling Node.js.
What causes "npm ERR! 'node' is not recognized as an internal or external command"?
Node.js was never added to system PATH during installation—the installer has an 'Add to PATH' checkbox that may be unchecked Node.js installation directory path is incorrect in PATH—pointing to a wrong or non-existent directory User PATH variable conflicts with System PATH variable—if user-level PATH contains an incomplete npm path, it takes precedence
Is the "npm ERR! 'node' is not recognized as an internal or external command" error serious?
Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.

Official resources & further reading