ng: command not found

前端 未结 11 1493
伪装坚强ぢ
伪装坚强ぢ 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 00:49

    In case others come here with this issue as I have, here is how I solved it system-wide on MacOS. Hope this helps.

    Verify node is installed:

    $ node -v
    v11.2.0
    

    Verify npm is installed:

    $ npm -v
    6.4.1
    

    Verify your npm global install file path is configured (known as prefix). Mine is under ~/.npm-packages:

    $ npm config ls -l | grep prefix
    prefix = "/Users/christiangroleau/.npm-packages"
    

    If not, you can place it into your ~/.npmrc file:

    echo prefix=~/.npm-packages >> ~/.npmrc
    

    Verify that your prefix path is listed in your system PATH:

    $ echo $PATH
    /Users/christiangroleau/.npm-packages/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
    

    If not, invoke the following:

    export PATH="$HOME/.npm-packages/bin:$PATH"
    

    Finally, you can reinstall angular-cli (in my case I needed to install it globally):

    $ npm install -g @angular/cli
    

    Verify installation:

    $ ng -v
    

提交回复
热议问题