If you encounter an error stating ‘NPM’ is not recognized as an internal or external command while opening or installing an application through Command Prompt, Windows PowerShell, or Terminal, this guide will help you fix the error. This problem could also appear when you try to install an app or run a batch file on a Windows 11/10 PC.
‘NPM’ is not recognized as an internal or external command
To fix the ‘NPM’ is not recognized as an internal or external command error, follow these solutions:
- Download latest version of Node.js
- Add or edit Environment Variable
To learn more about these solutions, continue reading.
1] Download latest version of Node.js
As NPM is the package manager of Node.js, it is highly recommended to download the latest version of Node.js when you see the above-mentioned error. To download the latest version of Node.js, you need to head to the nodejs.org website first.
Then, choose the version and operating system. Following that, you can choose the medium you want to use to install it. For example, you can choose fnm, Chocolatey, etc.
Once done, you can download the installer and go through the installation process.
2] Add or edit Environment Variable
To add or edit the Environment Variable, follow these steps:
- Search for “environment variable” in the Taskbar search box.
- Click on the individual search result.
- Click on the Environment Variables button.
- Click the New button in user variables for [username].
- Enter the variable name and variable value.
- Click the OK button.
- Click the OK button again.
Once done, you should not have problems again. For your information, you need to choose the variable value as the directory where you installed Node.js.
To confirm the change, you can open the Command Prompt or Terminal’s Command Prompt instance first. Then, enter this command:
npm –version
If you see the version number, you can use other commands as well. However, if you cannot find the version number, you need to set the variable correctly.
I hope this guide helped you to fix the issue.
Read: Java is not recognized as internal or external command
How to install npm in cmd?
To download NPM in CMD, you need to download the latest version package of Node.js from the official website. Then, you can go through the standard installation procedures to get the job done. However, it is very important to choose the correct operating system and system architecture.
Why is my Terminal not recognizing npm?
Terminal is not recognizing npm as an internal or external command because the path is not added in the Environment Variable section. You can modify or add the correct path first in order to allow Terminal, Command Prompt, or PowerShell to recognize the command parameter. For that, you need to open the System Properties, go to the Environment Variables section, and add a new User variable as mentioned above.
Read: WMIC is not recognized as an internal or external command.