How To Fix Angular's ng Is Not Recognized As An Internal Or External Command
You will get this error for two main reasons. One, is the Angular's ng command is not installed on your system at all. And second, ng command is installed, but its installation path wasn't added to Environment Variables on your Windows system. This means ng command will not be able to execute, if on your command prompt, you have not navigated to Angular's installation folder first. However, in most cases you will want to call ng from anywhere in your Terminal or Command Prompt. If you want to run ng from any location on your hard drive in the Window's command prompt, you have to add ng's folder location to Path variable in Windows 10 or 11. And just make sure that ng is actually installed.
You might have trouble figuring out Angular's default installation directory.
This is because Angular is a JavaScript framework, and it isn't installed to a specific directory like traditional software. Instead, it's usually installed globally or locally within a project via Node.js's package manager (npm) or Yarn.
Below are some common directories where Angular and its tools might be located on your computer:
Global Angular CLI installation with npm on Windows:
C:\Users\username\AppData\Roaming\npm\node_modules\@angular\cli\bin
Global Angular CLI installation with yarn on Unix-based systems:
/Users/username/.config/yarn/global/node_modules/@angular/cli/bin
Now, one step at a time...
When typing a command like ng into command prompt, Windows will look for that command first in the current directory. Current directory is displayed on the left hand side, such as C:\my_project\ for example.
If it doesn't find it there, it'll look in Path variable. This Path variable contains a list of directories to all programs that you want to be able to execute in your command prompt.
If the folder where your ng program is was never added to system Path environment variable, Windows will give you ng is not recognized as an internal or external command error, which means it doesn't know where ng.exe file is.
Note, this error can occur even after you've already installed Angular.

This error means just what it says. In attempt to find a command, executable program, or batch file, Windows failed to do it, after searching anywhere in the system.
Or just watch this quick YouTube video explaining how to fix git not recognized error:
How to fix: git not recognized as a command, program or batch file error
Note, this doesn't necessarily mean ng isn't installed. Just that it isn't added to environment variables.
In case of ng, however, this means Windows cannot find ng.exe command.
Type ng version on the command line:
(Note here I am launching it just from the C:\ drive)
C:\>ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ โณ \ | '_ \ / _' | | | | |/ _' | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 14.2.5
Node: 18.12.1 (Unsupported)
Package Manager: npm 8.19.2
OS: win32 x64
If this is the message you see, congratulations! This means you can run ng anywhere in command prompt on your hard drive, not just if your command prompt is currently pointing to the Angular's installation directory.
But what if you get an error every time you run ng command? Like this one:
C:\>ng version
'ng' is not recognized as an internal or external command,
operable program or batch file.
This is not a ng error. It's a Windows error.
You can type asdasd into command prompt, and you'll get the same error for asdasd.
If the folder your Angular was installed in was not added to Environment Variables, you will not be able to run ng command from anywhere on your hard drive, except that folder.
Adding directory where your ng program resides to system Path variable, will give Windows a hint, where to look for it when calling it from anywhere in the command prompt. This is also why sometimes other programs like VSCode, require you that you add ng to Path variable, so they can run it from their program environment too!
I wrote this tutorial to help you fix the ng is not recognized as internal or external command error. It may also say operable program or batch file. It might sound confusing, at first. However, this is a fairly common error with a very easy solution.
How To Fix NG Is Not Recognized As Internal Or External Command
The actual command name is ng.exe and it's just a Windows executable file, like any other.
Where is ng.exe located? Usually in the directory where you installed Angular.
First, identify where Angular is installed on your system.
This is the folder specified when you were installing it from the official Angular installer file.
By default it can be somewhere in your Program Files directory.
However, this is often what you should add to your Path variable, the bin folder.
C:\Users\username\AppData\Roaming\npm\node_modules\@angular\cli\bin
Just replace username with your own windows username that you see in C:\Users folder.
To fix Angular ng is not recognized as internal or external command, operable program or batch file, follow these steps:
- Click Start button.
- Start typing "environment variables", and press Enter.
- Click on Environment Variables button, close to lower right corner.
- Click anywhere in lower box that says System Variables.
- Scroll down until you see Path variable, and click on it once.
- Click on Edit button to start editing Path variable.
- Click New button to start a new blank variable.
- Type path to where you installed Angular on your system, and add /bin folder.
- Click Okay button 3 times in a row to exist and save your path variable.
Now for visual speed-learners, let's go over each step in detail:
Click Start button.
This one's easy. Just click on Start button from your Windows desktop.
Start typing "environment variables", and press Enter.
First, click on Start button and start typing "environment variables."

You don't even have to finish typing the complete phrase.
Just press Enter or Open button.
Click on Environment Variables button, close to lower right corner.
On this System Properties window that opens, click Environment Variables... button:

This leads us to the next step.
Click anywhere in lower box that says System Variables.
There are two main types of Environment Variables.
They are displayed on two separate lists on this window:

Both lists have the path variable on them. So how do we know which one to choose?
The upper box is user variables. Click on Path variable to highlight it, then click Edit button, and click on New button to add the folder where your ng program resides.
We're doing this to make ng available on the command line from any hard drive location, even C:\, and not just the folder where ng was installed. The idea behind user variables is that only the currently logged in Windows user's system configuration will be affected.
The lower box is called system variables. Adding ng to path here, will end up applying it systemwide. Regardless who is logged in, Windows will recognize ng command anywhere on the command line.
I personally use system variables, because nobody else is using my computer anyway.
Scroll down until you see Path variable, and click on it once.
Choose your list, and scroll down to find Path variable.
Click on the Path variable just one time to select it.
Click on Edit button to start editing Path variable.
Then click Edit button just underneath the list.
Now this new window should open that looks like this:

The Path variable contains multiple entries for all kinds of other programs.
This is the list to which we need to add the path to the folder where our ng is installed.
In other words, the directory where the executable file ng.exe is located.
Click New button to start a new blank variable.
Now, click on New button to add a new Environment Variable:

Type the location of your Angular installation folder into this new input box.
Type path to where your NG is installed on your system.
Simply start typing the path.
For example: C:\Angular\bin\.
Whatever the folder is where GIt was installed.
Click Okay button 3 times in a row to exist and save your path variable.
Press Enter to confirm your path.
Now to exit out of all Environment Variables windows, click Okay button 3 times, until all windows disappear.
Congratulations! At this point your ng has been added to system Path using environment variables.
Go to your cmd.exe and navigate to C:\ drive to verify if you can call ng command:
C:\>ng version
Angular CLI: 14.2.5
Node: 18.12.1 (Unsupported)
Package Manager: npm 8.19.2
OS: win32 x64
As you can see you can now call ng on command line from any hard drive location. This means other programs like VSCode, or Visual Studio, can call this command too from their own environments.
It took hours to put this material together. Please help me out by sharing it ๐
Click button below to share link on WhatsApp or Discord or with friends:
Hope this helps someone ๐ Please share this page!