Skip to content

ng-cli appears to install but does not run on Windows 10 #17071

Closed

Description

@MrRhino

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior
When trying to run the command "ng new my-app" i get this error message:
'ng' is not recognized as an internal or external command, operable program or batch file.

This is also reported by lots of others apparently having the same issue.

Expected behavior
The command "ng new my-app" should execute without any errors.

Minimal reproduction of the problem with instructions
On a Windows 10 machine:
Follow the cli-quickstart https://angular.io/docs/ts/latest/cli-quickstart.html

What is the motivation / use case for changing the behavior?
Trying to get started with the latest Angular 2 version

Please tell us about your environment:
CMD on Windows 10

  • Angular version: 2.0.X
    Latest Angular 2

  • Browser:
    Not relevant

  • Language:
    Not relevant

  • Node (for AoT issues): node --version = v7.10.0

Activity

  1. jotatoledo commented on May 28, 2017

    @jotatoledo
    Contributor

    The issue tracker for @angular/cli is here. Consider moving the issue to the right repo

  2. jotatoledo commented on May 28, 2017

    @jotatoledo
    Contributor

    How did u installed the cli? npm install -g @angular/cli or npm install @angular/cli?

  3. MrRhino commented on May 29, 2017

    @MrRhino
    Author
  4. ocombe commented on May 29, 2017

    @ocombe
    Contributor

    you can have this problem if you install it with both yarn & npm, uninstall in both and reinstall only with npm (if that was the case)

  5. MrRhino commented on May 29, 2017

    @MrRhino
    Author
  6. MrRhino commented on May 29, 2017

    @MrRhino
    Author

    I just responded to the same issue under angular/angular-cli [(https://github.com/angular/angular-cli/issues/6501)]
    with the following comment.

    For Windows 10 users only

    You can not install ng from the command line with a non administrator account
    And there is no sudo. Only runas which runs as the administrator with the administrator profile.
    The UAC does not kick in and ask you to provide admin permissions as when you run an installer.
    So the ng binary will be located in the Administrator npm folder after installing using the runas feature.

    Take a look at the folder "C:\Users\Administrator\AppData\Roaming\npm" and see if you can spot ng.
    If you can then add "C:\Users\Administrator\AppData\Roaming\npm" to your path.

    There is something called sudo for windows ( https://sourceforge.net/projects/sudowin/ )
    It runs with elevated permissions, while preserving your profiling settings.
    I haven't tried it. Use at own risk.

  7. usernamealreadyis commented on May 29, 2017

    @usernamealreadyis
  8. saharpure commented on May 9, 2018

    @saharpure

    any resolution on this issue? getting same problem on Windows 10, after running npm install @angular/cli -g getting ng not recognized.

    C:\Users\sh062v>npm install @angular/cli -g
    C:\Users\sh062v\AppData\Roaming\npm\ng -> C:\Users\sh062v\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
    
    > @angular/[email protected] postinstall C:\Users\sh062v\AppData\Roaming\npm\node_modules\@angular\cli
    > node ./bin/ng-update-message.js
    
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\@angular\cli\node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
    
    + @angular/[email protected]
    updated 1 package in 18.699s
    
  9. skm2017 commented on Dec 23, 2018

    @skm2017

    I faced the same issue after installing angular cli with npm install -g @angular/cli command on windows 10.
    Then I applied the solution offered by MrRhino and it worked.

    Take a look at the folder "C:\Users\your-user-folder\AppData\Roaming\npm" and see if you can spot ng. If you can, then add "C:\Users\your-user-folder\AppData\Roaming\npm" to your path.

    If you have any cmd open then close them and then re-open a cmd and try with ng command.

    Hope this helps someone.

  10. angular-automatic-lock-bot commented on Sep 14, 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.

  11. locked and limited conversation to collaborators on Sep 14, 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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions