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

后端 未结 30 2818
忘掉有多难
忘掉有多难 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

    For me (on MacOSX) I had to do:

    nvm install stable
    npm install -g angular-cli
    

    This installed ng into:

    /usr/local/lib/node_modules/@angular/cli/bin/ng
    

    But npm did not put a link to ng into

    /usr/local/bin/
    

    Which was why it was not part of the %PATH and therefore available from the command line except via an absolute address.

    So I used the following the create a link to ng:

    sudo ln -sf /usr/local/lib/node_modules/\@angular/cli/bin/ng /usr/local/bin/ng
    

提交回复
热议问题