ng new has stopped working after updating to Angular 6

前端 未结 4 1255
庸人自扰
庸人自扰 2020-12-10 18:30

Today, I updated my angular cli to the latest version and encountered an error that stops me from creating a new Angular project. Following is the error log that I get after

相关标签:
4条回答
  • 2020-12-10 18:39

    That happened to me, I thought that was a bug I reported it here, it turned out that I had a folder named node_modules on my home directory!

    To make sure this is the same issue with you run following commands

    npm ls -g @schematics/angular
    npm ls @schematics/angular 
    

    If the output of second command contains

    npm ERR! extraneous: @schematics/angular@0.6.0 C:\Users\User\node_modules\@angular\cli\node_modules\@schematics\angular
    

    then most likely you have the same issue as it appears that there is a node_modules folder with both the CLI and an old version of @schematics/angular installed locally (C:\Users\User). Remove this to fix this issue.

    Please check if it is the case for you too.

    0 讨论(0)
  • 2020-12-10 18:40

    I suspect that your upgrade of Angular CLI didn't go well. Try to uninstall and re-install it again:

    npm uninstall @angular/cli -g
    npm install @angular/cli -g
    
    0 讨论(0)
  • 2020-12-10 18:40

    Try uninstall and reinstall it again: npm ls -g @schematics/angular npm ls @schematics/angular

    0 讨论(0)
  • 2020-12-10 18:57

    I also got this error when I tried to issue, ng new

    I later realized it was as a result of issuing "npm install @angular/cli" which created a node_modules folder, in the directory I was working.

    Remove "node_modules" folder, and create your project now with "ng new"

    Ps. with the angular 6 upgrade, the ng team must specify that you cant just run "npm install @angular/cli" anywhere you want, but only in the newly created project. I think this is a bit unfair to the newbies to angular

    Hope this helps

    0 讨论(0)
提交回复
热议问题