ng: command not found while creating new project using angular-cli

后端 未结 30 2689
忘掉有多难
忘掉有多难 2020-11-28 23:42

Installed angular-cli globally using (npm install -g angular-cli) but when I\'m trying to create project using ng new my-project it is throwing err

相关标签:
30条回答
  • 2020-11-28 23:55

    Repairing NodeJS installation on windows resolved it for me.

    0 讨论(0)
  • 2020-11-28 23:56

    if you find this error when you are installing angular-cli, -bash: ng: command not found try this it works,

    After removing Node from your system

    install NVM from here https://github.com/creationix/nvm
    Install Node via NVM: nvm install stable
    run npm install -g angular-cli
    
    0 讨论(0)
  • 2020-11-28 23:57

    Run below commands:

    npm uninstall -g angular-cli
    
    npm uninstall -g @angular/cli
    
    npm cache clean
    
    npm install -g @angular/cli@latest
    

    alias ng="C:/Users/itaas/.npm-global/ng" ( Location of ng file in npm folder)

    And finally run :

    ng -v 
    

    0 讨论(0)
  • 2020-11-28 23:57

    If you are working in windows 7 and you can not run command start with ng

    please, update the angular/CLI at once and try to use ng commands

    use below comman to update latest CLI

    npm install -g @angular/cli@latest
    
    0 讨论(0)
  • 2020-11-28 23:59

    soluton for windows operating system only....... first step:

    install nodejs version: nodev 8.1.2

    second step: set up environment variable like: C:\ProgramFiles\nodejs

    Third step: install angular use this command: npm install -g @angular/cli

    after installation whereever you have to create project like: ng new first-project......

    0 讨论(0)
  • 2020-11-29 00:00

    Make sure that the npm directory is in your "Path" variable.

    If the module is installed properly, it may work if you start it out of your global node module directory, but your command line tool doesn't know where to find the ng command when you are not in this directory.

    For Win system variable add something like:

    %USERPROFILE%\AppData\Roaming\npm
    

    And if you use a unix-like terminal (emulator):

    PATH=$PATH:[path_to_your_user_profile]/path-to-npm
    
    0 讨论(0)
提交回复
热议问题