我已经花了大约 10 个小时来解决这个错误:
ERROR in ./src/main.ts
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. at Object.ngcLoader (C:\PRO\ANG\Cezar\CezarBot\Ajuro.Client\node_modules\@ngtools\webpack\src\loader.js:33:15)
ERROR in ./src/polyfills.ts
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. at Object.ngcLoader (C:\PRO\ANG\Cezar\CezarBot\Ajuro.Client\node_modules\@ngtools\webpack\src\loader.js:33:15)
我添加图像是因为更容易识别。在我尝试解决它时,我更新了节点,我重新安装了 webpack,我重新安装了@angular/cli、@ngtools/webpack,使用--force 清除了缓存,运行 npm install。我还重新安装了全局@angular/cli。
在某些时候,我最终在本地节点模块或 %appdata%/npm 中得到了一个或没有 @ngtools/webpack 版本。错误是一样的。
我认为它与@ngtools/webpack 无关我该如何调查?