ng: command not found

前端 未结 11 1504
伪装坚强ぢ
伪装坚强ぢ 2020-12-21 00:22

I am trying to run ng build in my project folder, but I get the following response:

bash: ng: command not found

Wha

11条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-21 01:00

    I had the same error, but I am running Windows 10 and none of answers worked for me. These were the steps I took to get it resolved:

    Verify Angular is installed by running the following command in Git BASH:

    npm run ng -v
    

    Install Angular if it is not already installed by running the following command:

    npm install -g @angular/cli@latest
    

    Get the npm PATH by running the following command:

    npm config get prefix
    

    Open up advanced system settings by either using the shortcut windows+pause (aka break) and clicking on Advanced System Settings or by using Cortana to search for the phrase System Environment Variables

    Click on Environment Variables to bring up the environment variables dialog.

    Select the row for the user variable Path and click on Edit

    Click on New and enter the path returned from earlier. Then click on OK and OK again to close out of the Environment Variables dialog.

    Restart Git BASH and test that it working by running the command:

    ng -v
    

提交回复
热议问题