ng new has stopped working after updating to Angular 6

99封情书 提交于 2019-11-29 07:22:12
Djidel

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.

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

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!