ng is not recognized as an internal or external command

For me it works with:

npm run ng <command>

I solved this problem in accordance with the figure:

run in cmd

 npm install -g @angular/cli

and then

( open in Windows 10) Control Panel\All Control Panel Items\System or accordance with the figure

step 1:

enter image description here

step 2 :

enter image description here

step3:

enter image description here

step4:

enter image description here

step5: add missing ng path

enter image description here

Here is new environment variable that you need add: C:\Users\PK\AppData\Roaming\npm\node_modules\@angular\cli\bin

Finally, restart all opened command prompts and try again.