Register Login

The 'npm' is not recognized as an internal or external command, operable program or batch file

Updated May 23, 2023

The npm is the world's most extensive software registry and package manager that supports programmers to install and manage packages needed for jQuery, react, yarn, bootstrap, and many other languages. Without deploying the accurate version of npm, users cannot access these packages, and users might face difficulty while handling the programs running under these programming languages.

Thus to execute an environment where users can access all these packages need the npm. The "npm, not recognized as an internal or external command, operable program, or batch file" is one of the most typical problems users face while running programs.

So this article gives a clear and detailed vision of the steps to install npm and run and manage packages for development purposes.

Here are the two reasons why users face such troubles and their associated solutions:

The 'npm' is not recognized as an  internal or external command

Often users get the error message "NPM not recognized as the internal or external command" when they try to access npm on Windows but have not installed it previously.

While checking the version of Windows, users will get such an error message as they have not installed the correct version of npm.

>npm -version

Method 1: NodeJS not installed

Users can install the npm package manager on Windows via NodeJS. Provided steps will help users to accomplish the task:

Step 1: The first step involves opening the Node.js official website using the provided link and clicking on download - Node.js installer:

Then, users navigate to the 'Downloads' folder and double-click on it to run the Node.js installer.

Step 2: It will take the users to the Node.js setup screen, where they click "Next" to install the program.

Then click on "Next" after accepting the terms and policies. Click the default specified location for Node.js installation and click the "Next" button.

Then click "Next" to proceed further.

Click on the "Install" option to start the installation. Then, after a successful installation, users click on the "Finish."

Step 3: Now users need to check whether they have solved the problem by running this command in the command prompt.

> npm --version

Method 2: Path and Environment Variables not set for NodeJS

Here, users will add the path of the npm on Windows. To access the npm on Windows, users need to add the path of the npm first and then use the package manager.

But, as we have seen, users will find the error while checking the version of Windows:

So to resolve this problem, follow the given steps and start using the npm package manager:

Step 1: Go to the Windows Command prompt, and find the installation path of the npm package manager:

> where npm

It will find the location of the installed npm package manager.

Step 2: Opening the environment variables

Go to the Windows Start menu and search "Edit the system Environment Variables."

Click on the option. Then click on "Environment Variables."

Go to "System Variables," click on "Path," and click edit option.

It will open the "Edit Environment Variables" window, click the "New" option, then type this variable path "C:\Program Files\node.js\," and finally, users press OK.

Step 3: Now users need to check whether they have solved the problem by running this command in the command prompt.

> npm --version

Conclusion:

In this article, we have discussed why users might face the error "npm is not recognized as an internal or external command." Also, this article highlighted all the methods that resolve the error, and users successfully install and run the npm package manager in their Windows.


×