Angular Ng Is Not Recognized | Fix PATH And CLI Fast

The “angular ng is not recognized” error means your shell can’t find Angular CLI; install @angular/cli and point PATH to npm’s global bin.

You type ng, hit Enter, and the terminal snaps back with “not recognized.” It feels like nothing happened, yet something did: your shell searched for an ng command and didn’t find one.

This article walks you through a clean fix on Windows, macOS, and Linux, plus a way to run ng with zero global installs. You’ll finish with a setup where ng version works every time.

What This Error Usually Means

Most of the time, ng is missing because Angular CLI isn’t installed, or it’s installed in a folder your shell doesn’t scan. On Windows, that folder is often an npm “global bin” path under your user profile.

Less often, Angular CLI is installed, but you’re running a different Node.js install than the one you used for the install. That can happen after switching Node versions, using a Node manager, or running a terminal as a different user.

Spot The Pattern In Your Message

  • “ng is not recognized…” — Your shell can’t locate ng on PATH.
  • “command not found: ng” — Same idea on many Unix shells.
  • “ng.ps1 cannot be loaded…” — PowerShell blocked a script file; ng.cmd still may work from Command Prompt.

Angular Ng Is Not Recognized On Windows: Fix Checklist

If you want the fastest route on Windows, follow these steps in order. Each step tells you what to run and what “good” looks like.

Confirm Node And npm Are Available

Open a fresh terminal window and run these commands.

  • Check node — Run node -v; you should see a version number.
  • Check npm — Run npm -v; you should see a version number.

If either command is missing, install Node.js first, then reopen your terminal so PATH refreshes.

Install Angular CLI Globally

Run this once. Use an admin terminal only if your machine blocks global installs for your user.

  • Install the CLI — Run npm install -g @angular/cli.
  • Verify it landed — Run npm list -g --depth=0 and confirm @angular/cli shows up.

If you previously installed the old package name angular-cli, remove it so there’s no mix-up between launchers.

  • Remove the old package — Run npm uninstall -g angular-cli.
  • Reinstall the current CLI — Run npm install -g @angular/cli again.

If the install fails with permission errors, run the same commands in a terminal started with “Run as administrator,” then retry in a normal terminal after it finishes.

Find The Folder That Holds ng

Don’t guess the folder. Ask npm where it puts global command files.

  • Print the global bin path — Run npm bin -g.

On many Windows installs, you’ll see a path under %AppData%\npm. That folder needs to be on PATH so ng can be found.

Add The npm Global Bin Folder To PATH

Use Windows Settings to add the folder you got from npm bin -g to PATH. Add it to your user PATH first so it follows your account.

  1. Open System Properties — Search Windows for “Edit the system variables,” then open it.
  2. Edit Path — Under User variables, select Path, then choose Edit.
  3. Add the folder — Paste the output from npm bin -g as a new entry.
  4. Restart terminals — Close all terminals, then open a new one.

Test The Fix

Now run:

  • Check CLI version — Run ng version.
  • Create a test app — Run ng new test-app and confirm it starts scaffolding.
What You See Likely Cause What To Do
“ng is not recognized…” CLI not installed or not on PATH Install @angular/cli, add npm bin -g folder to PATH
“ng.ps1 cannot be loaded…” PowerShell script policy blocks it Run in Command Prompt, or allow scripts for CurrentUser
ng works in one terminal, fails in another Old terminal session has stale PATH Close the terminal, open a new one

Fixing Angular Ng Not Recognized On macOS And Linux

On macOS and Linux, the message is usually “command not found: ng.” The cause is the same: the folder that holds the ng launcher isn’t on PATH, or the CLI isn’t installed yet.

Start with a clean terminal window. If you installed Node with a version manager, open a shell that loads that manager first, then run the checks below.

Install The CLI And Confirm The Bin Path

  • Check node and npm — Run node -v and npm -v; both should print a version.
  • Install Angular CLI — Run npm install -g @angular/cli.
  • Print the global bin folder — Run npm bin -g and note the output.

Put That Folder On PATH

If npm bin -g prints a folder under your home directory, add it to PATH through your shell profile so new terminals pick it up.

  • Edit your profile file — Open ~/.zshrc, ~/.bashrc, or ~/.profile, depending on your shell.
  • Add the bin folder — Append a PATH line that includes the folder from npm bin -g.
  • Reload the shell — Close the terminal and open a new one, or run source on the profile file.

After that, run ng version. If it still fails, check whether you have two Node installs and your shell is using a different one than npm.

Work Around PATH With npx

If you’re on a locked-down machine, or you don’t want global tools at all, npx is the simplest fallback. It downloads a CLI copy, runs it, then exits.

Fix It With npx When You Don’t Want Global Installs

Some machines lock down global installs, and some teams prefer project-local tools so builds are repeatable. In both cases, you can still run Angular CLI on demand with npx.

If you use npm 7 or newer, npm exec is another option. It runs a package binary with the same idea as npx, and it works well in scripts.

  • Run via npm exec — Run npm exec -- @angular/cli ng version.
  • Create a workspace — Run npm exec -- @angular/cli ng new my-app.

Run Angular CLI One-Off

This runs the CLI without adding a permanent ng command to your system.

  • Create a new app — Run npx @angular/cli new my-app.
  • Run a command — Run npx @angular/cli ng version.

Install The CLI In Your Project

If you already have a repo, add the CLI as a dev dependency, then call it through npm scripts. This keeps your team on the same CLI version.

  • Add the package — Run npm install -D @angular/cli.
  • Use npm run — Add scripts like "start": "ng serve" and run npm run start.

When Angular CLI Is Installed But ng Still Fails

At this point, the install is done and the error still shows up. That points to PATH, shell rules, or multiple Node installs.

Reinstall The CLI If Files Are Missing

Sometimes the install completes, yet the launcher files aren’t where your shell expects them. A quick reinstall clears that up, and it also removes half-installed folders that can linger after a canceled download.

  • Check the bin folder — Run npm bin -g, open that folder, and look for ng plus the Windows wrappers like ng.cmd.
  • Remove the CLI — Run npm uninstall -g @angular/cli.
  • Clear npm’s cache — Run npm cache clean --force if you keep seeing install errors.
  • Install again — Run npm install -g @angular/cli, then test ng version in a new terminal.

If your machine uses a proxy, npm can fail in a way that leaves no CLI files behind. In that case, fixing the network settings for npm comes first, then the reinstall will stick.

Check Which ng You Are Calling

Different shells have different commands for this.

  • Windows Command Prompt — Run where ng.
  • PowerShell — Run Get-Command ng.
  • macOS or Linux — Run which ng.

If you see no result, PATH still isn’t pointing to the folder that contains ng.

PowerShell Script Blocking

When you run ng, PowerShell may prefer a ng.ps1 wrapper. If scripts are blocked, you’ll get an error that mentions loading a .ps1 file.

  • Try Command Prompt — Run ng version in cmd.exe to confirm the CLI itself works.
  • Allow scripts for your user — Run Set-ExecutionPolicy RemoteSigned -Scope CurrentUser in PowerShell, then open a new window.

Fix A Custom npm Prefix

If you changed npm’s global install prefix, your global bin folder moved too. The fix is still the same: add the new bin folder to PATH.

  • Print the prefix — Run npm config get prefix.
  • Print the bin folder — Run npm bin -g.
  • Update PATH — Add that bin folder, then reopen terminals.

Match The CLI Version To Your Project

Once ng runs, you still want the right CLI version for your repo. A very new CLI with an old project can cause warnings, or a build that fails in surprising ways.

Start by checking what you have, then pick a path that fits your workflow.

Angular CLI follows the same major version rhythm as Angular packages. If you open an older repo, a global CLI from a newer install can try to rewrite config files in ways you didn’t expect. A safe move is to run the CLI version you need with npx, like npx @angular/cli@17 ng version, then use that same major for ng update. This keeps the project’s tooling in sync without touching your PATH on every run.

See Your Installed Versions

  • Show CLI details — Run ng version.
  • Show Node details — Run node -v and npm -v.

Use A Project-Scoped CLI For Consistent Builds

If your repo already pins Angular packages, running a local CLI keeps commands aligned with that version.

  • Run from node_modules — Use npx ng version inside the project.
  • Update with ng update — Run ng update @angular/cli @angular/core after reading the changes it proposes.

Final Checks Before You Run ng Again

These quick checks catch the last common gotchas, especially after you’ve changed PATH or installed new tooling.

  • Restart your editor — Close VS Code and reopen it so its integrated terminal picks up the new PATH.
  • Open a new terminal — Old sessions keep old PATH values.
  • Run the exact command — Type ng version first, then move on to ng serve.
  • Keep one Node install — Remove duplicate Node installs so npm and node stay paired.

If you still see “angular ng is not recognized” after all of this, copy the output of node -v, npm -v, and npm bin -g into a note and compare it across terminals. The mismatch almost always points straight to the missing PATH entry.