Sunday 19 March 2023

'npm' is not recognised as an internal or external command operable program or batch file error windows 10 fix

The error message "npm is not recognized as an internal or external command" typically means that Node.js and/or npm (Node Package Manager) is not installed on your system, or it is not added to the system's PATH environment variable.

To resolve this error, you can follow these steps:
  • Install Node.js: Download and install the latest version of Node.js from the official website https://nodejs.org/. Follow the installation instructions for your operating system.
  • Verify Node.js installation: After the installation is complete, open a new terminal window and run the following command to verify that Node.js is installed:
node -v

This command should print the version number of Node.js. If you see an error message, try restarting your terminal or computer and running the command again.
  • Verify npm installation: Run the following command to verify that npm is installed:
npm -v

This command should print the version number of npm. If you see an error message, it means that npm is not installed or not added to the system's PATH environment variable.

Add npm to PATH: If npm is not added to the system's PATH environment variable, you can add it manually. Here are the steps to add npm to the PATH variable on Windows:
Open the Start menu and search for "Environment Variables"
Click "Edit the system environment variables"
Click the "Environment Variables" button
Under "System Variables", find the "Path" variable and click "Edit"
Click "New" and enter the path to the npm installation directory (e.g. C:\Program Files\nodejs\node_modules\npm\bin)
Click "OK" to close all windows

Verify npm installation again: Open a new terminal window and run the following command to verify that npm is added to the PATH variable:

npm -v

This command should print the version number of npm. If you still see an error message, try restarting your terminal or computer and running the command again.After completing these steps, you should be able to use npm commands without getting any error.