If you’re getting the error message “‘npm’ is not recognized as an internal or external command” on Windows 11 and you have already installed node js into your system. it means that Node.js and NPM (Node Package Manager) are not properly installed or configured on your system. You need to set up Node.js and NPM correctly to resolve this issue. Here’s a step-by-step tutorial on how to do it:
Through this tutorial, you will learn how to fix npm is not recognized as an internal or external command, operable program or batch file by setting or adding node js npm path to environment variables in Windows 11/10.
NPM is not recognized as an internal or external command Windows 11
Step-by-step guide to resolve NPM is not recognized as an internal or external command Windows 11:
- 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.
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.