angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng is not recognized as an internal or external command

Open muscaiu opened this issue 10 years ago • 26 comments

Running windows 7 Professional 32bit.

I tried running npm install -g angular-cli both under normal or admin. 2016-06-23_14h46_40

I also tried adding it to the Enviorment Variables under PATH: (C:\Users\Administrator\AppData\Roaming\npm\node_modules\angular-cli\bin\ng) , with no success also.
2016-06-23_14h56_48

What am i doing wrong?

muscaiu avatar Jun 23 '16 12:06 muscaiu

The only thing that you are doing wrong is using windows :smile:

Just add %AppData%\npm; to the user variable(since %AppData% dir is depending on user) PATH to fix it.

You will need to log out then log back in for the change to your PATH variable to take effect.

RicardoVaranda avatar Jun 23 '16 12:06 RicardoVaranda

@muscaiu are you still having this problem? @RicardoVaranda's solution seems the right one. Your system wasn't configured with the right PATH for some reason.

filipesilva avatar Jul 04 '16 01:07 filipesilva

I have the same problem, the path to npm added to the PATH variable, so I think the problem is that the system can not run "ng" file.

XK8 avatar Jul 06 '16 15:07 XK8

I fixed the problem. See here: http://stackoverflow.com/questions/37991556/ng-is-not-recognized-as-an-internal-or-external-command

muscaiu avatar Jul 07 '16 05:07 muscaiu

Thanks, fix it.

XK8 avatar Jul 10 '16 16:07 XK8

In case you are editing environment variables make sure you edit for account you are running under.

dasariramacharan avatar May 08 '17 15:05 dasariramacharan

After spend about one hour to fix "ng is not recognized" in my Windows console I opened a new prompt as "administrator", unninstalled the "angular-cli", cleaned npm cache via "npm cache clean" and installed it again and finally worked o/

I guess the main issue is because you need to do all this installation process as root ("as administrator" in Windows).

luizhsalazar avatar May 17 '17 17:05 luizhsalazar

Use NodeJS command prompt rather Windows Command, NodeJs command prompt will recognize ng.

untitled

Shrutikarekal123 avatar Jun 21 '17 07:06 Shrutikarekal123

Just open your command prompt (run as administrator). Ensure node --v is 6.9.0 or higher and npm --v is 3.0.0 r higher.

After that run the following command:

npm install -g @angular/cli

Once angular is installed. you can see an entry of angular cli in the path

C:\Users\Dell\AppData\Roaming\npm\node_modules@angular

Then try ng help. It will work.

gautamjgithub avatar Jun 28 '17 13:06 gautamjgithub

i had same "ng is not recognized as internal and external command,operable program or batch file " node version:6.10 just upgrade new version like node 6.11 or latest while re-installing angular put it in new path like c://erp/ee

dhanabalu avatar Jul 05 '17 11:07 dhanabalu

At last find the solution for ng command is not working issue ,Find the solution below http://itechiesol.blogspot.com/2017/07/angular-cli-ng-command-is-not-working.html

naru6be avatar Jul 22 '17 13:07 naru6be

@Shrutikarekal123 it works now perfectly, thank you very much :)

NataliaReyes avatar Aug 27 '17 00:08 NataliaReyes

@gautamjgithub i added %APPDATA%\npm\node_modules@angular to my PATH and it worked! Thanks!

renatop7 avatar Oct 31 '17 16:10 renatop7

if you try any of the above method and not working make make sure you are using a git bash. This works for one window system i work on. some command do not work on a CMD either as an admin or not. you can download a git bash for window system here https://git-scm.com/downloads

willypelz avatar Nov 21 '17 14:11 willypelz

I had the same problem today and have gone through the following path - (%USERPROFILE%\AppData\Roaming\npm) and came to know that there is some junk data and when I cleared everything under npm directory. Now when I ran (npm install command again). Now everything works fine.

yaswanthbs avatar Dec 15 '17 06:12 yaswanthbs

Just as an update for anyone running into the same. ng was working fine for me. Yesterday I installed Miktex on my computer and after that ng stopped working. I think it messed up with my Path variable somehow. Adding the npm path again as @RicardoVaranda said works.

joaopgrassi avatar Jan 26 '18 13:01 joaopgrassi

Use NodeJS command prompt. I fix my problem.

dinukarumesh avatar Mar 26 '18 08:03 dinukarumesh

Just execut:

npm run ng <command name>

yosvelquintero avatar May 18 '18 12:05 yosvelquintero

Add the ng command path from the folder .bin under the node_modules to PATH variable in the system env settings e.g: add C:\testProject\node_modules\.bin\ to PATH

cjoantony avatar Jun 05 '18 14:06 cjoantony

run : npm install -g angular-cli set the path variable =C:\Users\ACER\AppData\Roaming\npm\node_modules\angular-cli\bin

SunaliBandara avatar Jun 28 '18 18:06 SunaliBandara