Today, while working through some basic AngularJS Intro, I ran into a problem. I opened PowerShell to get going on the project. NPM worked.
I was able to install the Angular using
npm install -g @angular/cli
Anytime I tried to run ng I would get
the term 'ng' is not recognized as the name of a cmdlet
Solution Worked For me :
Add a path to your environment Variable
as well as your bin folder of the angular file [present their itself]
and then run
ng -v
it will pop up angular cli gui in your Command prompt. Note After runningnpm i -g @angular/cli
do restart your command prompt and check if it works otherwise clean cache and repeats the above steps.The first path in the path variable needs to be the NPM path. Opening the Node.js command prompt I found that the ng command worked there. I dug into the shortcut and found that it references a command to ensure the first Path variable is NPM. To Fix:
%AppData%\npm
Once I did that I was able to close powershell and reopen and all worked.
I was using npm (5.5.1) updating it to latest version solved my problem.