You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ng is not recognized as an internal or external command #1183
I tried running npm install -g angular-cli both under normal or admin.
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.
The only thing that you are doing wrong is using windows 😄
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.
Reacted by Shehbaz, Arthur LOYS, Mossab MAHAT, Snez, Yumarx Polanco, Woxis17, Alexandre Koné, ArihantJain929, Marius, Rama and 106 more
Reacted by Thiago Leite, DanyloGitylo, hedgehogus, GiefSeMoney, Denis Bachilo, Olulana Kolawole, DonBakke, Víctor Hugo Hernández, cyberyak, Petr Kubát and 46 more
Reacted by Rinold, gocs, Amanda Vilela, Shreyansh, waploaj, Chris Engelsma, Alameer Ashraf Hassan, justasdev, ELAZHAR Anas, mikrambajwa and 22 more
Reacted by Lairson Barreto de Melo Filho, Alexander Liam Wells, Albert, toan-dao and Günter Zöchbauer
Reacted by LabPhilip and Cacanny
Reacted by Arshan Khanifar, Rinold, Camiclakis, Shreyansh, TejaReddy141116, me@ans, Jesús, Muskan Kataria, Luis Raúl Espinoza Barboza, VicPlanning and 12 more
Reacted by Albert, Siva Nagaraju Galla, Jacek Jusianiec, Günter Zöchbauer and Adam Awity
@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.
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).
Reacted by Patrick Moriarty, PON GOPI PRAKASH PONNUSAMI, Ahmad Kanj and mdiazc
Use NodeJS command prompt rather Windows Command, NodeJs command prompt will recognize ng.
Reacted by Sonam Arun, Natalia Reyes, Pallavi Gupta, Jean Carlo Flores Carrasco, Abhishek Soni, Michael DePouw, JP Gangwar, KevalPatel, Chandan G, Juliana and 4 more
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
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
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.
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.
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
I had the same issue "'ng' is not recognized as an internal or external command,
operable program or batch file." when I was trying to run ng serve --host 0.0.0.0 form my command prompt.
But as I run it via node.js command prompt, my issue resolve and I was able to run
ng serve --host 0.0.0.0.
And
It also ran when I prefix it with npm run ng serve as mentioned above, but then I was facing issue for --host 0.0.0.0 as it was throwing error.
Can anyone tell me the reason why? What is happening which I am unable to get.?
Activity
RicardoVaranda commentedon Jun 23, 2016
The only thing that you are doing wrong is using windows 😄
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.
filipesilva commentedon Jul 4, 2016
@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.
XK8 commentedon Jul 6, 2016
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.
muscaiu commentedon Jul 7, 2016
I fixed the problem.
See here: http://stackoverflow.com/questions/37991556/ng-is-not-recognized-as-an-internal-or-external-command
XK8 commentedon Jul 10, 2016
Thanks, fix it.
dasariramacharan commentedon May 8, 2017
In case you are editing environment variables make sure you edit for account you are running under.
luizhsalazar commentedon May 17, 2017
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).
Shrutikarekal123 commentedon Jun 21, 2017
Use NodeJS command prompt rather Windows Command, NodeJs command prompt will recognize ng.
gautamjgithub commentedon Jun 28, 2017
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.
dhanabalu commentedon Jul 5, 2017
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
naru6be commentedon Jul 22, 2017
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
NataliaReyes commentedon Aug 27, 2017
@Shrutikarekal123 it works now perfectly, thank you very much :)
renatop7 commentedon Oct 31, 2017
@gautamjgithub i added %APPDATA%\npm\node_modules@angular to my PATH and it worked! Thanks!
willypelz commentedon Nov 21, 2017
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
yaswanthbs commentedon Dec 15, 2017
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.
joaopgrassi commentedon Jan 26, 2018
Just as an update for anyone running into the same.
ngwas 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.dinukarumesh commentedon Mar 26, 2018
Use NodeJS command prompt. I fix my problem.
yosvelquintero commentedon May 18, 2018
Just execut:
npm run ng <command name>cjoantony commentedon Jun 5, 2018
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\toPATHSunaliBandara commentedon Jun 28, 2018
run : npm install -g angular-cli
set the path variable =C:\Users\ACER\AppData\Roaming\npm\node_modules\angular-cli\bin
AhmetFUsta commentedon Oct 3, 2018
You don't have to log out and back in, all you need to do is restart explorer.exe OR open up your CMD and run
refreshenvdebjyoti-pandit commentedon Oct 9, 2018
I had the same issue "'ng' is not recognized as an internal or external command,
operable program or batch file." when I was trying to run ng serve --host 0.0.0.0 form my command prompt.
But as I run it via node.js command prompt, my issue resolve and I was able to run
ng serve --host 0.0.0.0.
And
It also ran when I prefix it with npm run ng serve as mentioned above, but then I was facing issue for --host 0.0.0.0 as it was throwing error.
Can anyone tell me the reason why? What is happening which I am unable to get.?
b2rpt commentedon Feb 2, 2019
please don't confuse yourself... just do one thing
ADD -> " C:\Users\DELL\AppData\Roaming\npm " to PATH in system variable
All set !
tarundvarma49 commentedon Mar 19, 2019
Please try to use Node.js command prompt in your windows. It will work.
atul-bajpai commentedon Aug 17, 2019
npm start also works great
angular-automatic-lock-bot commentedon Sep 17, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.