'ng' is not recognized as an internal or external command, operating program or batch file

I tried running npm install -g angular -cli

enter image description here

I also tried adding it to the Enviorment variables in the PATH section: (C: \ Users \ Administrator \ AppData \ Roaming \ npm \ node_modules \ angular-cli \ bin \ ng), without any success. enter image description here

+33
source share
13 answers

Use the NodeJS command line, and the Windows Command, the NodeJs command recognizes ng.

+47
source

You can also try:

 > npm run ng <command>
+63
source

C:\Users\Administrator\AppData\Roaming\npm\node_modules\angular-cli\bin\ng PATH. javascript , .

ng.cmd, , , %AppData%\Roaming\npm. , PATH.

+30

Windows7. .

  1. ng.cmd . :

    E:\Users\<USERNAME>\AppData\Roaming\npm
    
  2. PATH .

  3. ng -v
    

-g.

npm install -g @angular/cli
+20

, ng.cmd. C:\Users\user\AppData\Roaming\npm

NB: "" pc!

+10

, . CLI .

C:\usr\local , CLI .

enter image description here

Windows :

Advanced > Environment Variable > User Variables and System Variables :

enter image description here

, cmd 'ng':

enter image description here

+6

, .

control panel-> system->advanced system settings-> select advanced Tab->
click on environment variables

,

'C:\Users\username\AppData\Roaming\npm'   

,

, , , , ,

,

,

   npm uninstall -g @angular/cli

    npm cache clean    or   npm cache clean  --force

    npm install -g @angular/cli@latest
+3

, Windows 7 , Node.js, . , angular.

+3

angular cli , ng , , . ,

npm (.npmrc), C:\Users {user}. registry https://registry.npmjs.org/=true. , . . . . .

npm config edit
+2

Angular/Cli.

  1. , PATH npm PATH .

C:\Users\yourusername\AppData\Roaming\npm

  1. git ng-v .
+2

- . , problem-

1-

C:\Users\user\AppData\Roaming and delete npm, npm-update and npm-cache folder

2-

npm install -g @angular/cli@yourangularversion again.
+1

,

.npmrc

C:\Users\username

prefix=$(APPDATA)\npm

+1

: -

  1. npm install -g @angular/cli
  2. Add below to the environment variable Path: -
    A. C: \ Program Files \ nodejs \ node_modules \ npm \ bin
    B. C: \ Users {userName} \ AppData \ Roaming \ npm C. C: \ Users {userName} \ AppData \ Roaming \ npm \ node_modules @angular \ cli \ bin
+1
source

All Articles