angular-cli: ng : command not found

windows 10 - Git Bash

Hello, I tried a lot of solutions on the net but nothing works: / I still have: ng: command not found

it should be noted that the command was working a few days ago …

otherwise, I notice that I miss the executable ng, someone would have a solution? I’m stuck since a week on my project: /

image

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 16 (2 by maintainers)

Most upvoted comments

Did you try uninstalling and installing the angular cli? I.e.

npm uninstall -g @angular/cli
npm install -g @angular/cli

For anyone who is new to angular and having issues with ng,

On windows 10, nodejs (and hence NPM) installed under C:\ProgramFiles\nodejs, which was on my system path. However, when installing @angular/cli globally (npm install -g @angular/cli), by default this installed to C:\users\<me>\AppData\Roaming, which I had to manually add to the system path. Once added to the path, it was picked up by git-bash, cmd etc…

I was facing the same issue, tried with root/administrator user it worked for me. So use sudo npm install -g @angular/cli

For anyone who is new to angular and having issues with ng,

On windows 10, nodejs (and hence NPM) installed under C:\ProgramFiles\nodejs, which was on my system path. However, when installing @angular/cli globally (npm install -g @angular/cli), by default this installed to C:\users\<me>\AppData\Roaming, which I had to manually add to the system path. Once added to the path, it was picked up by git-bash, cmd etc…

in my case (windows10), the issue is just the same, but the path to be added is C:\users\<me>\AppData\Roaming\npm hope i would help someone

Run following command when you open command line:- alias ng="<path-to-this-place>/AppData/Roaming/npm/node_modules/@angular/cli/bin/ng"

It just needs to executed every time you open command line but it will work.

@anupama-netke took your advice and did this: sudo npm uninstall -g @angular/cli sudo npm install -g @angular/cli sudo ng generate component Home

You are a boss!