Skip to content

ng is not recognized as an internal or external command #1183

Closed

Description

@muscaiu

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?

Activity

  1. RicardoVaranda commented on Jun 23, 2016

    @RicardoVaranda
    Contributor

    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.

  2. filipesilva commented on Jul 4, 2016

    @filipesilva
    Contributor

    @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.

  3. XK8 commented on Jul 6, 2016

    @XK8

    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.

  4. muscaiu commented on Jul 7, 2016

    @muscaiu
    Author
  5. XK8 commented on Jul 10, 2016

    @XK8

    Thanks, fix it.

  6. dasariramacharan commented on May 8, 2017

    @dasariramacharan

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

  7. luizhsalazar commented on May 17, 2017

    @luizhsalazar

    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).

  8. Shrutikarekal123 commented on Jun 21, 2017

    @Shrutikarekal123

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

    untitled

  9. gautamjgithub commented on Jun 28, 2017

    @gautamjgithub

    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.

  10. dhanabalu commented on Jul 5, 2017

    @dhanabalu

    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

  11. naru6be commented on Jul 22, 2017

    @naru6be

    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

  12. NataliaReyes commented on Aug 27, 2017

    @NataliaReyes

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

  13. renatop7 commented on Oct 31, 2017

    @renatop7

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

  14. willypelz commented on Nov 21, 2017

    @willypelz

    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

  15. yaswanthbs commented on Dec 15, 2017

    @yaswanthbs

    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.

  16. joaopgrassi commented on Jan 26, 2018

    @joaopgrassi

    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.

  17. dinukarumesh commented on Mar 26, 2018

    @dinukarumesh

    Use NodeJS command prompt. I fix my problem.

  18. yosvelquintero commented on May 18, 2018

    @yosvelquintero

    Just execut:

    npm run ng <command name>

  19. cjoantony commented on Jun 5, 2018

    @cjoantony

    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

  20. SunaliBandara commented on Jun 28, 2018

    @SunaliBandara

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

  21. AhmetFUsta commented on Oct 3, 2018

    @AhmetFUsta

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

    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 refreshenv

  22. debjyoti-pandit commented on Oct 9, 2018

    @debjyoti-pandit

    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.?

  23. b2rpt commented on Feb 2, 2019

    @b2rpt

    please don't confuse yourself... just do one thing

    ADD -> " C:\Users\DELL\AppData\Roaming\npm " to PATH in system variable

    All set !

  24. tarundvarma49 commented on Mar 19, 2019

    @tarundvarma49

    Please try to use Node.js command prompt in your windows. It will work.

  25. atul-bajpai commented on Aug 17, 2019

    @atul-bajpai

    npm start also works great

  26. angular-automatic-lock-bot commented on Sep 17, 2019

    @angular-automatic-lock-bot

    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.

  27. locked and limited conversation to collaborators on Sep 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions