nvm for Windows installs but npm cannot be found
Cannot find the npm fileShort answer
On Windows the npm that nvm gives you only works when nvm can create its symlink and no older Node.js sits earlier in PATH. Remove the old install, enable Windows developer mode, pick a symlink folder that does not exist yet, install a version with nvm install, and use CMD or PowerShell.
Fix it fast
1Find out which cause you have
Run the built-in diagnostic in an Administrator CMD or PowerShell window. It reports symlink and PATH problems that explain why npm is not found.
nvm debug nvm list2Match what you see, then jump to its fix
- 1
nvm list shows no version, or no star next to the one you expectThe Node.js version is not installed, or none is selectedFix - 2
node -v shows a version you did not select with nvm useAn older Node.js install is earlier in PATH or blocks the symlinkFix - 3
Exit 1, exit 5 or Access Denied from nvm use or nvm installnvm cannot create the symlink because of permissionsFix - 4
nvm use appears to work but admin-required steps are ignored (Cygwin, mingw, cmder, ConEmu, Hyper)You are in a shell nvm-windows does not supportFix
- 1
What does the error look like?
Cannot find the npm file'npm' is not recognized as an internal or external command
Cause 1 of 4
The Node.js version is not installed, or none is selected
1Check
npm comes with each installed Node.js version. If the install failed, or you never ran nvm use, there is no npm to find.
nvm list
nvm current2Fix
Install a version, then select it.
nvm install 22.12.0
nvm use 22.12.03Verify
Open a new terminal and print both versions.
node -v
npm -vConfirmed by github.com
Cause 2 of 4
An older Node.js install is earlier in PATH or blocks the symlink
1Check
Windows searches PATH in order, so a leftover Node.js directory listed before nvm's symlink wins. An existing folder at the symlink location also blocks nvm; the README says it will not overwrite one, even an empty one.
where node
dir "C:\Program Files\nodejs"2Fix
Uninstall the old Node.js (back up your global npmrc first), delete leftover folders such as C:\Program Files\nodejs, and use nvm debug to confirm the symlink path is free. If NVM_SYMLINK points at an existing folder, point it at one that does not exist yet.
nvm debug
nvm use 22.12.03Verify
where node lists only the nvm symlink path.
where node
npm -vConfirmed by github.com
Cause 3 of 4
nvm cannot create the symlink because of permissions
1Check
The wiki names Windows developer mode as the most common fix, because switching versions creates a symlink. It also advises against keeping Node.js installs in protected folders such as C:\Program Files.
nvm root
nvm debug2Fix
Turn on Windows developer mode (or run the shell as Administrator), and keep nvm's root in a folder like C:\nvm4w rather than Program Files.
nvm root C:\nvm4w
nvm install 22.12.0
nvm use 22.12.03Verify
nvm use finishes without an access error and npm -v prints a version.
npm -vConfirmed by github.com
Cause 4 of 4
You are in a shell nvm-windows does not support
1Check
The wiki lists Cygwin, mingw, cmder, ConEmu and Hyper as unsupported, because they ignore UAC prompts that nvm needs.
echo %ComSpec%2Fix
Run the same commands in the regular Windows Command Prompt or PowerShell.
nvm use 22.12.0
npm -v3Verify
npm -v prints a version in the supported shell.
npm -vConfirmed by github.com
How do I stop it coming back?
- Uninstall any existing Node.js before installing nvm-windows.
- Install nvm-windows on the C: drive; the wiki lists installs on other drives failing silently in one release.
- Keep nvm root and the symlink folder outside Program Files.
- Close the terminal when a new install does not appear, and reopen it.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Web apps
tsconfig rejects allowImportingTsExtensions
An error that allowImportingTsExtensions needs noEmit or emitDeclarationOnly
allowImportingTsExtensions lets files import each other with .ts or .tsx extensions, and TypeScript only allows it together with noEmit or emitDeclarationOnly.
2 causes, each with a fixWeb apps
Apollo Server rejects a request as a potential CSRF
HTTP 400 Bad Request from the GraphQL endpoint
Apollo Server's CSRF prevention is on by default.
3 causes, each with a fixWeb apps
React shows Attempted import error when importing a component or function
Attempted import error:
The build found the file but not the name you asked for.
2 causes, each with a fixWeb apps
AxiosError Network Error with code ERR_NETWORK in a React app
Network Error
ERR_NETWORK means the request produced no readable response.
4 causes, each with a fixWeb apps
Axios get works with a URL string but ignores the object passed as the second argument
The server log shows a GET with no query string
axios.get takes a URL and an optional config object.
3 causes, each with a fixWeb apps
Can't resolve '../axios' in a React project
Module not found: Error: Can't resolve '../axios'
A path that starts with ./ or ../ is a file path, not the axios package.
3 causes, each with a fix