How to Fix npm command not found
Last reviewed
Error message
'npm' is not recognized as the name of a cmdlet, function, script file, or operable program. (or `npm: command not found` on macOS/Linux.)
npm ships with Node.js. If you've never installed Node, install it first; everything else is PATH troubleshooting.
What this error means
Your shell can't find npm on your PATH. Either Node.js isn't installed, or it's installed but the directory containing npm isn't on PATH for the current shell session.
Why this happens
Node not installed, partial install, PATH not refreshed since install, or you're in an Administrator shell that has a different PATH than your user shell.
Quick fix (for end users)
- Confirm Node is installed.
- Close and reopen your terminal — installers don't always refresh existing shell sessions.
Admin / engineer fix
Check Node and npm are on PATH.
commandnode -v npm -vOn Windows, install Node from https://nodejs.org or with winget.
commandwinget install OpenJS.NodeJSOn macOS/Linux, prefer a version manager like nvm.
commandcurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash nvm install --lts
Step-by-step fix
Run `node -v` to check whether Node itself is installed.
If not, install Node from nodejs.org or via your package manager.
Close and reopen the terminal so PATH refreshes.
Affected products
Node.js
Common variations of this error
People also see these phrasings of the same problem:
bash: npm: command not foundzsh: command not found: npm
Still broken? Try these
- On Windows, check both User PATH and System PATH (System Properties → Environment Variables).
- If installed via Chocolatey/winget, run `refreshenv` in PowerShell or restart the shell.
- Make sure your IDE's integrated terminal isn't pinned to a stale shell.
Related searches
- install node.js windows
- fix npm not recognized
Frequently asked questions
Do I need to install npm separately?
No. npm ships with Node.js. If you have Node, you have npm.
Browse more errors in Windows Admin: Fix Windows administration errors. Access denied, RPC server unavailable, trust relationship failures, Group Policy errors, and network path issues. Or paste your own error into the error decoder tool to find a match. You can also go back to the homepage to browse common errors by topic.