The “npm is not recognized” message means Windows can’t find npm.exe because Node.js isn’t installed right or the PATH variable doesn’t include it.
You type npm, hit Enter, and Windows replies with the dreaded line: “npm is not recognized as an internal or external command.” That single sentence can stop a project cold. No installs. No scripts. No builds. Just a blinking cursor and a lot of wasted time.
The fix is rarely mysterious. Windows can only run commands it can locate in folders listed in PATH. Npm is installed with Node.js, so when npm can’t be found, either Node.js and npm never landed on your PC, or PATH never learned where they are.
This guide walks through a clean order that works for most setups: check what Windows can see, repair the install if needed, then set PATH so every new terminal can run npm without extra steps.
What This Error Means In Plain Terms
Windows doesn’t search your whole drive when you run a command. It checks the current folder, then checks each folder listed in PATH, top to bottom. If it can’t find a matching executable or command file, it prints the “not recognized” message.
Npm on Windows is usually exposed through files like npm.cmd and npx.cmd. When PATH contains the folder that holds those files, npm works from any directory. When PATH is missing that folder, Windows has no clue where to look.
| What You See | Likely Cause | What To Run |
|---|---|---|
node works, npm fails |
PATH points to Node, not npm files | where npm |
node and npm both fail |
Node.js not installed or PATH empty | where node |
| Works in one shell, fails in another | Old session or different shell setup | Close and reopen the shell |
Before you change anything, do two quick checks. They tell you where you stand, and they keep you from fixing the wrong thing.
Npm Is Not Recognized As An Internal Or External Command
Run these checks in a fresh Command Prompt window. A new window matters because it loads the current PATH. An older window can keep stale values.
- Open a clean terminal — Close all Command Prompt and PowerShell windows, then open a new one.
- Check Node first — Run
node -v. If you get a version number, Node is on PATH. - Check npm next — Run
npm -v. If it prints a version, the problem is already solved in this session. - Ask Windows to locate npm — Run
where npm. No output means PATH can’t see npm. - Ask Windows to locate Node — Run
where node. If you see multiple lines, PATH has more than one Node install.
If node -v works and npm -v fails, you’re close. Windows can find Node, so PATH is at least partly set. The remaining work is almost always correcting PATH entries so the npm command files are visible.
If both commands fail, treat it as a missing or broken Node.js install first. A PATH tweak won’t help if the files are not on disk.
Install Or Repair Node.js So Npm Exists
On Windows, npm ships with Node.js. The simplest repair is the official Node.js installer, since it places Node and npm in standard folders and writes PATH entries for you.
- Uninstall Node.js — Open Settings, go to Apps, find Node.js, then uninstall it.
- Remove leftover version managers — If you installed nvm-windows or similar tools, uninstall them too so PATH doesn’t point to dead folders.
- Restart Windows — A reboot clears locked files and forces all apps to reload system settings.
- Install Node.js from the official site — Download the Windows installer from nodejs.org and run it.
- Keep default installer options — Make sure the option that adds Node to PATH stays enabled.
- Reopen a terminal — Then run
node -vandnpm -vagain.
If the installer finishes and the error still shows up, don’t keep reinstalling. Move on to locating the actual files and fixing PATH directly. That’s where the problem usually sits.
Fixing Npm Not Recognized On Windows With PATH
PATH is a list of folders. Add the right folders and Windows can run npm from anywhere. Add the wrong folders and you end up chasing ghosts. Start by confirming where Node and npm are installed on your PC.
Find The Real Install Folders
Most official installs use C:\Program Files\nodejs\. In that folder you should see node.exe, plus command files for npm and npx. Some npm-related command files also live in a user folder under AppData, especially for global installs.
- Open the Node folder — In File Explorer, check
C:\Program Files\nodejs\. - Confirm Node is present — Look for
node.exe. - Confirm npm command files exist — Look for
npm.cmdandnpx.cmd. - Check the common user npm bin folder — Check
%AppData%\npmfor additional command files.
If you can’t find C:\Program Files\nodejs\, search the Start menu for “Node.js.” Open the Node.js folder from there, then check its location in File Explorer. Some installs land in a different drive if you changed defaults.
Add PATH Entries In Windows 10 And 11
Once you know the folders, add them to PATH. Use your user PATH first unless you need npm for all accounts on the PC. User PATH is safer for shared machines.
- Open advanced system settings — Press Start, type “Edit the system variables,” then open it.
- Open the variables dialog — Click the button that opens the variables list.
- Edit your user PATH — Under user variables, select Path, then click Edit.
- Add the Node folder — Add
C:\Program Files\nodejs\if it isn’t listed. - Add the user npm bin folder — Add
%AppData%\npmif you install global packages and expect global commands. - Save all dialogs — Click OK until every window closes.
- Reopen the terminal — Close the old window, open a new one, then test
npm -v.
After you edit PATH, validate what Windows will run. These commands are quick and give you a clear answer.
where node
where npm
node -v
npm -v
If where npm prints multiple paths, the first one is the one Windows uses. If the first path points to a folder you don’t want, move that PATH entry lower, or remove it, so the intended one wins.
Common Traps That Keep The Error Coming Back
If PATH is correct and you still see the message later, something is changing what your shell sees. These are the traps that show up most often on Windows machines used for dev work.
Two Node Setups Fighting For Control
A common pattern is installing Node.js, then installing a version manager, then uninstalling one of them. PATH ends up pointing at folders that no longer exist, or it points at a Node version you didn’t mean to use.
Windows Store installs can also confuse command lookup. The Store version may register aliases that point to a stub app. If your where node output mentions WindowsApps, remove the Store install, disable the alias entries in Settings, then reinstall Node from nodejs.org and reopen your terminal.
- List every command location — Run
where nodeandwhere npmand copy the output. - Choose one setup — Stick with the official installer or a version manager. Mixing them invites conflicts.
- Remove dead PATH entries — Delete entries that point to missing folders, then reopen the shell.
Old Terminal Sessions And Editor Terminals
PATH is loaded when a shell starts. If you change PATH and keep using the same terminal window, the shell keeps the old value. Some editors keep a terminal alive even when you close a project, so the mismatch can stick around.
- Restart the terminal — Close the window fully and open a new one after PATH edits.
- Restart the editor — Quit your editor fully so its internal terminal resets.
PowerShell Finding The Wrong Thing
PowerShell resolves commands a little differently than Command Prompt. It can also prefer functions or aliases with the same name. If npm works in Command Prompt and fails in PowerShell, check what PowerShell thinks npm is.
- Resolve the command in PowerShell — Run
Get-Command npmand read the path it returns. - Test through cmd — Run
cmd /c npm -vto confirm npm itself runs on your system. - Remove conflicting aliases — If an alias masks npm, remove it in your PowerShell profile.
User Npm Folder Listed But Empty
Sometimes PATH includes %AppData%\npm, yet that folder has no npm.cmd. This can happen after a partial uninstall, or after copying user profiles between PCs. PATH is correct, but the files are missing.
- Inspect the folder contents — Open
%AppData%\npmand confirm command files exist. - Repair with the installer — Reinstall Node.js to restore the missing files.
- Recheck command resolution — Run
where npmagain and confirm it points to real files.
Verify The Fix And Keep It Working
Once npm runs, do a quick sanity test that covers the common failure points: version checks, command lookup, and a tiny install in a throwaway folder.
- Confirm versions — Run
node -vandnpm -vand note the output. - Confirm paths — Run
where nodeandwhere npmand confirm the first result is the one you expect. - Test a fresh project — Create a new folder, run
npm init -y, then runnpm i left-pad, then delete the folder.
If you ever see the same line again, paste the output of where npm next to your PATH list. The mismatch will stand out fast. When PATH points to a missing folder, fix the entry. When PATH points to a different Node install, pick one install method and clean the rest.
After you fix it once, it tends to stay fixed. Keep installs tidy, avoid stacking Node tools, and reopen terminals after system changes. That’s what stops “npm is not recognized as an internal or external command” from returning at the worst moment.
Npm Is Not Recognized As An Internal Or External Command
If you want a quick wrap-up you can follow any time the error shows up, use this short checklist. It’s the same logic as the longer steps, just condensed into a repeatable flow.
- Run version checks — Try
node -vandnpm -vin a new terminal window. - Locate the executables — Run
where nodeandwhere npmand confirm the first result is correct. - Repair the install — If Node is missing, reinstall from nodejs.org.
- Fix PATH entries — Add
C:\Program Files\nodejs\and%AppData%\npm, then reopen the terminal. - Remove conflicts — If multiple paths show up, delete old entries so one Node setup remains.
