Common Causes
Node.js is not installed properly – Installation may be incomplete or corrupted.
Environment variables are not set correctly – The system might not be locating Node.js.
npm is outdated or missing – The npm installation could be corrupted.
Multiple versions of Node.js causing conflicts – Older versions might be interfering.
Command Prompt/Terminal needs a restart – The session may not be updated with the correct path.
Troubleshooting Steps
Run the following command to check if Node.js is installed:
node -v
If this returns an error, reinstall Node.js from nodejs.org.
Ensure npm is installed correctly by running:
npm -v
If npm is missing, reinstall Node.js or install npm separately using:
npm install -g npm
Open System Properties → Advanced → Environment Variables.
Locate Path under System variables.
Ensure it contains the correct Node.js path (e.g., C:\Program Files\nodejs).
If missing, add it manually and restart the terminal.
If you have multiple Node.js versions, use nvm to manage them:
nvm use stable
After making changes, restart your terminal or system for the settings to take effect.
If this not works you can check: https://www.codercrafter.in/blogs/nodejs/npm-not-recognizing-node-despite-path-being-correct