'ng' is not recognized as an internal or external command, operable program or batch file

前端 未结 19 1352
轻奢々
轻奢々 2021-01-31 01:31

I tried running npm install -g angular-cli

I also tried adding it to the Enviorment Variables under PATH: (C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node

19条回答
  •  滥情空心
    2021-01-31 02:17

    This answer is based on the following answer by @YuSolution https://stackoverflow.com/a/44622211/4567504.

    In my case Installing MySQL changed my path variable and even after reinstalling @angular/cli globally many times I was not able to fix the issue.

    Solution:

    In command prompt, run the following command

    npm config get prefix
    

    A path will be returned like

    C:\Users{{Your_Username}}\AppData\Roaming\npm

    Copy this path and go to ControlPanel > System and Security > System, Click on Advanced System settings, go to advanced tab and select environment variable button like

    Now in User Variables box click on Path row and edit and in variable value box paste your copied path.

    Restart the command prompt and it will work

提交回复
热议问题