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

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

    In my case, I was simply running the wrong node version.

    I had just previously installed a new node version to play around with Angular (2). At work we use 6.x so that is my default in nvm. After restarting the laptop ng stopped working simply because I was running node 6.x again. So for me it was simply a matter of using the version with which I was installing the Angular CLI:

    nvm use node // with the node alias pointing to the right version
    

    or

    nvm use v8.11.3 // if you happen to know the version
    

    Check your installed versions and aliases with

    nvm list 
    

提交回复
热议问题