Blog

How To Fix NPM Not Recognized as Internal or External Command

NPM Not Recognized as Internal or External Command

npm is one of the top extensive package managers that is used to install and manage the packages used for development purposes such as jQuery, react, yarn, bootstrap, and many more. It is open-source and automatically installed with nodejs installation or can be obtained as a separate installation.

How To Fix NPM Not Recognized as Internal or External Command

Occasionally, we get the error “NPM not recognized as the internal or external command” when we try to access npm through the command line. If you are not sure how to fix the mentioned error. Do not worry!

In this blog, we will provide the solution to resolve the specified error “NPM not recognized as the internal or external command” in Windows.

 

Error 1: NPM is Not Installed or Missing Path

Sometimes we get an “NPM not recognized as the internal or external command” error when we try to utilize npm on Windows but it is actually not installed. As we are trying to check the NPM version on Windows Command Prompt using npm. But we are getting an “NPM not recognized as the internal or external command” error.


Step to Fix: Install NodeJS

The “NPM is not recognized as an internal or external command” error may occur if we do not have npm on windows. The npm package manager is installable on Windows via NodeJS. For this purpose go through the provided steps:

Step 1: Download Node.js Installer

First, open the Node.js official website using the given link and start downloading Node.js installer:

https://nodejs.org/en/

After that, navigate to the “Downloads” folder and execute the Node.js installer by double clicking on it:

Step 2: Install Node.js and npm

Upon doing so, the Node.js setup window will display on the screen. Press the “Next” button to begin the installation of Node.js:

Read and accept all license terms and hit the “Next” button:

Go with the default selected location for Node.js installation and click the “Next” button:

Press the “Next” button to move forward toward Node.js installation:

Lastly, hit the “Install” button to begin the installation of Node.js:

We have completely installed Node.js, press the “Finish” button to exit the setup process:

Step 3: Verify Error is Resolved or not

Next, check if the error is resolved or not by verifying the npm version using provided command:

> npm –version

 

Solution 2: Add the Path of NPM to Windows

We used npm in Windows through the command line and it is automatically installed with Node.js installation. Sometimes we get an “NPM not recognized as the internal or external command” error when we try to utilize npm on Windows.

In order to access npm through the Windows command line, it is required to add npm to the Windows path first. For this purpose, utilize the given instruction and resolve the specified error.

To resolve the displayed error, follow the given instruction.

Step 1: Open Windows Command Prompt

Firstly, open the Windows Command Prompt by searching “Command Prompt” in the “Startup” menu:

Step 2: Find NPM Installation Location

Find the location where the npm is already installed using the “where” command. By default, npm is installed in the “C:\Program Files\nodejs” directory. Execute the following command to get the location of NPM:

> where npm

Step 3: Open Environment Variable Settings

To set npm path to Windows path, open the environment variables setting by searching it in the “Startup” menu:

 

Click on the “Environment Variables” button:

From the “System variables”, choose the property “Path” and hit the “Edit” button:

After that, from the “Edit environment variables” window, click the “New” button, paste here the copied path and press the “Ok” button:

 

Step 4: Check Error is Resolved or not

Now, verify whether the issue is resolved or not by checking out the npm version:

> npm –version

You can see that we have successfully resolved the “NPM not recognized as an internal or external command” error on Windows.

How To Fix NPM Not Recognized as Internal or External Command

Conclusion

The error “npm is not recognized as an internal or external command” error may occur because either the npm is not installed or it is not added to the windows path. To resolve this error, the first solution is to install Node.js on Windows as Node.js is equipped with npm by default. The second solution refers to adding the path of NPM on windows. In this blog, we have offered you the possible solutions to resolve the specified error.

 

Leave a Reply

Your email address will not be published. Required fields are marked *