I tried running npm install -g angular-cli
I also tried adding it to the Enviorment Variables under PATH: (C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node
make sure environment variables are set properly.
control panel-> system->advanced system settings-> select advanced Tab->
click on environment variables
and make sure in the path below line is available
`C:\Users\username\AppData\Roaming\npm`
here username will get changed based on the user
.
still if its not working yourenvironment variables are not getting reflected so please restart your machine it will work fine
if still you are facing issue your angular cli is not installed properly
please run below commands for reinstalling
npm uninstall -g @angular/cli
npm cache clean or npm cache clean --force
npm install -g @angular/cli@latest
You can also try:
> npm run ng <command>
What worked for me was that I was missing an file
.npmrc
which is located under
C:\Users\username
That file should contain
prefix=$(APPDATA)\npm
Also my environment path was pointing to my admin user
You should not add C:\Users\Administrator\AppData\Roaming\npm\node_modules\angular-cli\bin\ng
to your PATH. There is only a javascript file which you cannot use in terminal.
You need ng.cmd
which is probably located at %AppData%\Roaming\npm
.
Make sure this path is included in your PATH variable.
No need to uninstall angular/cli.
C:\Users\yourusername\AppData\Roaming\npm
ng-v
again and should workYou should add the path where ng.cmd located. By default, it should be located on C:\Users\user\AppData\Roaming\npm
NB: Here "user" may vary as per your pc username!