ng command is not working in visual studio


Even tough google and stackexchange is full of these question, I can’t seem to find the answer.

I have setup web application template with angular as frontend (.net 5.0)
i tried to add an angular component using ‘ng g c component’ but i’m getting an error ng is not recognized as a command.

when I try npm run ng g c component i got ng is not recognized as a script.

i have checked npm version which is 7.20.3 using visual studio 2019 latest version
ng is included in my packages.json file.

Any idea why I can’t use the ng command in the package manager console?


Aha it does work.

I have uninstalled node.js since i had a none lts version, reinstalled the lts version
uninstalled angular/cli locally and globally and did npm cache clean

After that reinstalled angular/cli.
And that fixed the issue.

Answered By – Technology Researcher

Answer Checked By – Candace Johnson (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.