NPM is not recognized as an internal or external command Windows 11|10

“’npm’ is not recognized as an internal or external command, operable program or batch file” error might mean that Node.js and npm (Node Package Manager) are not installed or the system’s PATH environment variable is not set properly.

In this tutorial, you will learn how to fix npm not recognized as internal or external commands.

Here are some approaches, you can try to fix this error:

Approach 1: Check the current version of Node.js & NPM

First of all, open your Windows command prompt and use the given command to check whether Node js or npm is installed in your system or not.

node -v
npm -v
  • If you have Node JS and NPM installed then use the second approach to set the PATH environment variables of NPM and Node JS to the system.
  • Or if it is not installed then you can click on this link to see how to node js and npm install properly in windows.

Approach 2: Set the npm system’s PATH environment variable

If you have Node JS and NPM installed then use this approach to set the PATH environment variables of NPM and Node JS in the system:

  • Step 1 – Go to Start and type “environment variables”
  • Step 2 – Click Environment Variable
  • Step 3 – Edit System Environment Variable Path
  • Step 4 – Add Node js Npm path to environment variable
  • Step 5 – Stop & Start CMD
  • Step 6 – Test Node js Npm Version

Step 1 – Go to Start and type “environment variables”

First of all, Open the Start menu & search for “Environment Variables” and select “Edit the system environment variables.” like the following:

Step 2 – Click Environment Variable

Then, In the System Properties window, click the “Environment Variables” button; as shown below picture:

Step 3 – Edit System Environment Variable Path

Inside the Environment Variables menu, go to the System variables submenu, select Path, then click the Edit button.; as shown below picture:

Step 4 – Add Node js Npm path to environment variable

Click the “New” button and add the following paths (or similar paths depending on your installation):

  • For Node.js: C:\Program Files\nodejs
  • For NPM: C:\Users\<YourUsername>\AppData\Roaming\npm

Make sure to replace <YourUsername> with your actual Windows username.

Click “OK” to close the “Edit environment variable” dialog, “OK” again to close the “Environment Variables” dialog, and one last “OK” to close the “System Properties” dialog.

Step 5 – Stop & Start CMD

Restart any open command prompt windows, or open a new one. Now, you should be able to run node js npm commands from any directory within the command prompt.

Step 6 – Test Node js Npm Version

Open a new Command Prompt or PowerShell window and run the following commands again to verify that Node.js and NPM are recognized:

node -v
npm -v

If the output displays the node js npm version, then node js has been successfully added to the PATH variable.

Approach 3: Reinstall Node js and NPM

Still the error was not resolved. So you can use this last approach. In this, you will first have to uninstall node.js and reinstall it.

Here are the steps on how to uninstall Node.js on Windows:

  1. Open the Control Panel.
  2. Click on Programs and Features.
  3. Look for Node.js in the list of programs.
  4. Click on Uninstall.

To install Node.js on Windows 11|10, you can try these steps: 

  1. Download the Windows installer from www.Nodejs.org
  2. Run the installer
  3. Follow the prompts
  4. Accept the license agreement
  5. Accept the default installation settings
  6. Restart your computer
  7. Double-click to install .msi binary files
  8. Verify the installation by opening a command prompt or PowerShell and entering node -v

Conclusion

After following these steps, you should no longer see the “‘npm’ is not recognized as an internal or external command” error on Windows 11, and you can use NPM to manage your Node.js packages and projects.

Recommended Tutorials

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

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