The term 'ng' is not recognized as the name of a cmdlet

后端 未结 30 819
灰色年华
灰色年华 2020-12-01 00:24

Today, while working through some basic AngularJS Intro, I ran into a problem.

I opened PowerShell to get going on the project. NPM worked.

I was able to in

相关标签:
30条回答
  • 2020-12-01 00:53

    You should update node js to latest version. Otherwise uninstall node js and install it again.

    0 讨论(0)
  • 2020-12-01 00:54

    Run Powershell or command prompt not as administrator.

    0 讨论(0)
  • 2020-12-01 00:56

    First setup Node.js, then go to your project folder with the command prompt such as D:\project and then run this command:

    npm install -g @angular/cli
    

    Now run ng command. This work for me.

    0 讨论(0)
  • 2020-12-01 00:57

    I used the following:

    npm run ng serve
    

    It worked for me without need to set Environment variables.

    I had to install a typescript after it:

    npm install typescript@">=3.4 <3.6"
    
    0 讨论(0)
  • 2020-12-01 00:57

    For VSCode Terminal First open cmd and install angular-cli as global

    npm install -g @angular/cli
    

    Then update your Environment Variables following this step

    1. win + s // this will open search box
    2. Type Edit Environment Variables
    3. Open Environment Variables
    4. Add %AppData%\npm inside PATH
    5. Click OK and close.

    Now you can restart your VSCode and it will work as it will normally do.

    0 讨论(0)
  • 2020-12-01 00:57

    Selected Advanced System Settings enter image description here Clicked "Environment Variables" enter image description here Under "Path" variable, made the FIRST value listed %AppData%\npm enter image description here I did that.Close powershell and reopen. all worked

    0 讨论(0)
提交回复
热议问题