angular编译出错解决办法Angular Compiler was detected but it was an instance of the wrong class.

2018-08-21 15:29:38 浏览数 (1)

出现如下错误:

错误信息

代码语言:javascript复制
Module build failed: Error: Angular Compiler was detected but it was an instance of the wrong class.
This likely means you have several @ngtools/webpack packages installed. You can check this with `npm ls @ngtools/webpack`, and then remove the extra copies.

大致意思是,出现错误,原因可能是安装了几个不同版本的@ngtools/webpack包,你可以使用npm ls @ngtools/webpack命令来检查,然后删除多余的副本。

代码语言:javascript复制
npm ls @ngtools/webpack

果然有两个版本

提示@ngtools/webpack@1.8.0版本是多于的,然后去目录下面把它删掉,问题解决。

0 人点赞