Ng Is Not Recognized As An Internal Or External Command | Fix It Fast

The ng not recognized error means Windows can’t find Angular CLI’s ng.cmd through your PATH.

You run ng to start a project, generate a component, or check versions. Then the terminal tells you it isn’t a command. That message feels vague, yet it points to a simple fact: your shell searched for a file named ng (or ng.cmd) and didn’t see it in any folder listed in PATH.

Below, you’ll confirm what’s missing, fix it on Windows, and learn a clean fallback that runs Angular CLI without a global install. You’ll also avoid the common trap of adding the wrong folder to PATH and ending up with more confusion.

It’s a setup snag, not a broken Angular project.

On shared PCs, check user and system PATH entries. A tool installed for a different login won’t show in your shell until you add that bin folder.

What The Error Means In Plain Terms

Every time you type a command, Windows checks the current folder, then checks each folder listed in PATH. If none of those folders contains a matching executable, you get the “not recognized” message.

Angular CLI installs a small launcher file for Windows called ng.cmd. That file usually lives in npm’s global “bin” folder. If that folder isn’t on PATH, Windows won’t see ng.cmd, even if Angular CLI is installed.

When people hit this, the cause is usually one of these:

  • Missing Angular CLI Install@angular/cli was never installed on the machine.
  • Missing Npm Global Bin In PATH — The install exists, yet the folder that holds ng.cmd isn’t listed in PATH.
  • Old Shell Session — You changed PATH or installed the CLI, yet the terminal window you’re using still has old values loaded.
  • Conflicting Node Installs — A version manager, an old Node folder, or a changed npm prefix sends global installs to a different place than your shell expects.

Fast Checks Before You Change Anything

These checks take two minutes and keep you from guessing. Run them in the same terminal where you saw the error.

  1. Confirm Node Works — Run node -v. If it fails, install or repair Node first.
  2. Confirm Npm Works — Run npm -v. If it fails, Node is installed incorrectly or your terminal can’t see npm.
  3. See If Windows Can Locate Ng — Run where ng in Command Prompt. If it prints a path to ng.cmd, the CLI is present and your issue is often just a shell refresh.
  4. Check Where Global Tools Install — Run npm config get prefix. On Windows, global command files usually land in that prefix folder.
  5. Confirm Angular CLI Is Installed — Run npm list -g @angular/cli. If it shows nothing, you don’t have a global CLI install.
  6. Restart The Terminal — Close the terminal app, reopen it, then try ng version again.

One extra check can save time when npm’s folders are unclear. Run npm root -g to see where global packages live, and run npm prefix -g to see where command files should land. If those two paths don’t line up with what you see in a folder window, fix prefix first, then reinstall Angular CLI.

If you saw ng is not recognized as an internal or external command, keep going. The next sections walk you through the two fixes that solve nearly every case.

Ng Is Not Recognized As An Internal Or External Command

On Windows, the most common fix is simple: make sure the npm global bin folder that contains ng.cmd is listed in PATH. Do this once and the command works in any new terminal session.

Find The Folder That Holds Ng.cmd

Don’t guess the path. Find the exact folder on your machine so you add the right entry the first time.

  1. Check The Npm Prefix — Run npm config get prefix and copy the path it prints.
  2. Check The Usual Windows Bin Folder — Open a folder window and paste %AppData%\npm into the location bar.
  3. Confirm With Where — Run where ng. If Angular CLI is installed and reachable, you should see a path ending in ng.cmd.

Add The Correct Folder To PATH

Once you know the correct folder, add it to PATH so every new terminal can find it.

  1. Open System Properties — Press Win, type “Edit the system variables,” then open it.
  2. Open Variables Window — Click “Variables,” then select Path under your user section, then click “Edit.”
  3. Add The Npm Bin Folder — Click “New” and add the folder that contains ng.cmd, often %AppData%\npm.
  4. Save And Refresh — Click OK on all dialogs, close terminals, then reopen them.

After that, run ng version. If it works, you’re done with the core fix. If it still fails, don’t keep stacking random paths. Switch to a clean install so you remove conflicts instead of piling on workarounds.

Clean Install That Avoids Conflicts

If you’ve installed Node more than once, used a version manager in the past, or changed npm’s prefix at some point, a clean install can be faster than chasing a single bad entry. The goal is one Node install, one npm, one predictable global bin folder.

Remove Old Pieces That Cause Clashes

  1. Uninstall Node — Use Windows “Apps & features” to remove Node.js, then reboot.
  2. Clear Old Global Shims — Visit %AppData%\npm and remove old ng* files if you see them and you’re sure they’re stale.
  3. Check For Multiple Node Locations — Search your drive for node.exe. If you see multiple copies in different folders, keep one install path and remove the rest.

Install Fresh, Then Recheck PATH

  1. Install Node LTS — Install the current LTS build from the official Node site, then reboot once.
  2. Confirm Versions — Run node -v and npm -v to confirm they launch cleanly.
  3. Install Angular CLI — Run npm install -g @angular/cli.
  4. Verify The Launcher File — Run where ng and confirm it points to ng.cmd in a single folder.

If the install succeeds but the command still fails, it almost always means the bin folder isn’t on PATH, or the shell didn’t reload variables yet. Close terminals, reopen them, then try again before you change anything else.

Run Angular CLI Without A Global Install

Some people avoid global installs on purpose. It keeps machine setup smaller, and it prevents one project from stepping on another. You can still run Angular CLI through npx, which comes with npm.

Create A Project With Npx

  1. Pick A Working Foldercd into the folder where you want the project created.
  2. Run The One-Time CLI — Use npx -p @angular/cli ng new my-app and follow the prompts.
  3. Run Common Commands — Inside the project folder, run npx ng serve, npx ng build, or npx ng test.

Why Npx Sidesteps The Problem

  • No Global Bin Needed — You’re invoking the CLI through npx, so Windows doesn’t need to find ng.cmd globally.
  • Project-Level Version Control — You can pin a specific CLI version by running npx -p @angular/cli@17 ng version when you need it.
  • Less Drift Over Time — You avoid global tool updates changing behavior across older projects.

If you mainly want to ship and don’t want to touch system settings, npx is a clean workaround that still keeps you in the normal Angular workflow.

Ng Not Recognized After Install Fix Checks

If the standard fixes didn’t stick, something on the machine is still steering installs or command lookup in an unexpected direction. The checks below target the cases that waste the most time.

Command Works In One Shell But Not Another

  1. Test In Command Prompt — Run where ng and ng version in Command Prompt first.
  2. Compare Shell Behavior — If you also use PowerShell, run the same commands there and compare results.
  3. Confirm You’re Running The Same Tool — If PowerShell reports a different path, you’re not launching the same ng.cmd file.

Global Installs Land In A Strange Folder

  1. Read The Prefix — Run npm config get prefix and note the path.
  2. Reset Prefix If Needed — If that prefix points to a locked folder or an old drive, reset it back to a normal user path.
  3. Reinstall After The Reset — Run npm uninstall -g @angular/cli, then npm install -g @angular/cli.

Npm Is Present But Acts Broken

  1. Repair Node Install — Rerun the Node installer and use its Repair option if it appears.
  2. Check Cache Folder Access — Verify %AppData%\npm-cache exists and your user account can write to it.
  3. Try A Fresh Terminal — Close terminals, reopen, then rerun npm -v and npm install -g @angular/cli.

Quick Reference Table

Symptom You See What It Means Fast Fix
where ng returns nothing CLI missing or bin folder not on PATH Install @angular/cli, then add %AppData%\npm to PATH
where ng shows a path, yet ng fails Old shell session still loaded Close terminals, reopen, then retry ng version
Command Prompt works, PowerShell fails PowerShell script rules block a launcher Run via Command Prompt, then adjust PowerShell rules if needed
Global installs appear under an unexpected drive Npm prefix changed Reset prefix, reinstall CLI, then recheck with where ng

When It Works In One App But Not In Another

It’s common to fix PATH, test in Command Prompt, then open an editor terminal and still hit the same error. That doesn’t mean the fix failed. Many apps read user variables only at launch, so they keep an old snapshot until you restart them.

  1. Restart The Editor — Close it, reopen it, then run where ng inside its terminal.
  2. Check Shell Profile Files — If you use Git Bash or a custom shell, confirm it isn’t overriding PATH inside a profile script.
  3. Test The Same Command In Two Places — Run where ng in Command Prompt and in the app terminal. If the outputs differ, the app is still on old settings.

Also watch for a naming clash. If a folder in your project contains a file named ng, some shells try that first. Running where ng keeps you honest because it shows what the shell will actually execute.

A Simple Routine To Confirm You’re Done

  1. Check Versions — Run node -v, npm -v, then ng version.
  2. Confirm The Path — Run where ng and verify it points to a single, expected folder.
  3. Test A Real Command — Run ng new test-app or npx ng new test-app to confirm the tool chain works end to end.
  4. Keep One Install Style — Stick with global CLI plus PATH, or stick with npx. Mixing styles across shells is what brings the error back.

If you ever see ng is not recognized as an internal or external command again, use this two-step check before you touch anything else: run npm config get prefix, then confirm that folder contains ng.cmd and is listed in PATH. That’s the quickest way to get from error to working command with minimal fuss.