1

I was running nG version 17.3 on my Win10 system. I wanted to upgrade my Angular CLI to latest version 19. So I did the following steps-

  1. npm uninstall -g @angular/cli
    
  2. npm install -g @angular/cli@latest
    

Now, if I try to run ng version on my command prompt, it gives the following message

'ng' is not recognized as an internal or external command,
operable program or batch file.

My whole system is screwed up. How do I get Angular up and running again with the latest CLI installed?

5
  • 1
    Maybe your global npm packages aren't working in general, are you able to install other npm packages globally? For example, check if this question helps you. stackoverflow.com/q/30710550/5470544 Commented Dec 6, 2024 at 20:15
  • I have edited your question and removed the parts pointing out the urgency of the issue. This will not give you any faster results, it tends to have the opposite effect. Also see: meta.stackoverflow.com/q/326569/5470544 Commented Dec 6, 2024 at 20:20
  • Ok, @JSONDerulo thanks. Commented Dec 7, 2024 at 10:02
  • Did the linked question solve your issue? If yes, I can mark this question as a duplicate, to help future readers. Commented Dec 7, 2024 at 11:42
  • Hi @JSONDerulo I have finally got this working. The steps I followed were - 1. npm uninstall -g @angular/cli 2. npm cache clean 3. npm install -g @angular/cli/@latest Now if I run ng version from comm. prompt, it shows the installed version as 19. I checked the environment variables to make sure the path is present there. It is. I have VS CODE installed on my system. I tried running some ng commands from the integrated terminal of that too. They are working, much to my relief. Commented Dec 7, 2024 at 15:00

2 Answers 2

3

After running npm uninstall -g @angular/cli which uninstalls the Angular CLI, you would need to run npm install -g @angular/cli to have the Angular CLI installed again and be able to use the commands starting with ng.

@WillHelpYou is right - when changing Node.js versions you typically need to also run npm install -g @angular/cli since when you change your Node.js version (especially using tools like nvm or manually reinstalling Node.js), you often lose access to globally installed packages like the Angular CLI.

Sign up to request clarification or add additional context in comments.

Comments

1

Currently enrolled in Angular bootcamp, had same Issues few days back first Check Node.jsand npm Versions-

Run node -v and npm -v to ensure you have compatible versions installed.

Add npm to PATH:

Open the System Properties window.

Click the "Advanced" tab.

Click "Environment Variables."

Edit the "Path" variable under "System variables" to include the npm global installation path (usually C:\Users<Your_User_Name>\AppData\Roaming\npm).

Restart your command prompt.

Reinstall Angular CLI:

Run npm install -g @angular/cli@latest in an administrator command prompt.

I prefer removing -g if you want to use different angular versions for different projects because they may collide. This is my hypothesis.

Verify Installation:

Run ng v to check if Angular CLI is recognized.

Try restarting Your PC

These Angular developers push new versions every 6 months hard to cope up with deprecated properties.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.