npm Command Not Found: Check Node.js, npm and PATH

If your terminal says npm is not found or not recognized, first confirm that Node.js and npm are installed and visible to the current shell.

Node.js · npmWindows · macOS · LinuxLast reviewed Sep 23, 2026
🎯 You’re likely in the right place if:
Running npm returns “command not found” or “not recognized”.You expect Node.js/npm to already be installed.The problem occurs in a terminal, shell or command prompt.
Difficulty: Easy–ModerateRisk: Low
🔎 Quick Check — confirm whether npm is visible

Check whether your current shell can find npm. Use the command for your operating system below.

Windows: where npm macOS/Linux: command -v npm

Verify: If a path is returned, npm exists and the problem may be shell/session or command context. If no path is returned, verify the Node.js/npm installation and PATH.

Did Fix #1 work?
ADSENSE · reserved slot after the first useful fix

Why this happens

The shell can only run npm when the executable or launcher is installed and reachable through the environment PATH. A fresh installation can also require closing and reopening the terminal before the updated PATH is visible.

Diagnose before changing more

1
Does node work?
Run node --version. If Node.js is also missing, fix the Node.js installation before treating npm as a separate problem.
2
Was Node.js just installed?
Close the terminal completely and open a new one so the shell reads the updated environment.
3
Does the path command return npm?
If a path exists, inspect which installation it points to before reinstalling anything.

Fix #2 — repair the installation or PATH

If neither node nor npm is visible, repair or reinstall Node.js using the installation method appropriate for your operating system. If Node works but npm does not, inspect the installation path and avoid adding random directories to PATH.

🟡 Before changing configuration: note the current setting so it is easy to reverse.
Did Fix #2 work?

Still seeing the error?

Compare node --version with the npm path result. If multiple Node installations exist, remove the ambiguity before making more PATH changes. Version managers can also change which installation the current shell sees.

Still stuck? Ask the community

Share your operating system, software version, exact error text, and which fix you already tried. Another reader may have seen the same setup.

Keep it safe: never post passwords, API keys, access tokens, recovery codes, license keys, private URLs, or confidential logs.
Powered by GitHub DiscussionsSign in with GitHub to comment. Reading comments does not require sign-in.

Loading community discussion…