错误:已安装多个@ ngtools/webpack软件包 [英] Error: several @ngtools/webpack packages installed
问题描述
更新:升级到1.7.0.beta.1可以解决此问题,但是现在我又遇到了另一个错误:
UPDATE: upgrading to 1.7.0.beta.1 fixed the issue, but now I'm getting another error:
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:\Users\multi\Desktop\portfolioWeb\node_modules\@ngtools\webpack\src\loader.js:458:19)
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ERROR in ./src/polyfills.ts
推荐答案
我也遇到了同样的错误.在您的项目目录中打开package.json,然后尝试删除安装webpack的行(@ ngtools/webpack)-似乎新版本1.7.0都已安装了该行.至少在我的项目中,这解决了该问题.然后重新安装ang-cli.我不知道是否需要重新安装-您可以在修改package.json之后尝试运行'npm prune'-这应该删除package.json中不存在的模块.
I had this same error. Open your package.json in your project directory and try removing the line that installs webpack (@ngtools/webpack) - it seems that it's installed anyway with the new 1.7.0. At least in my project this fixed the issue. Then reinstall ang-cli. I don't know if reinstall is required - you might just try running 'npm prune' after modifying the package.json - this should remove modules that are not present in your package.json.
您可以通过运行推荐的"npm ls @ ngtools/webpack"来检查是否已删除重复项-它应仅显示您安装的版本,而不显示以前的版本.
You can check if the duplicate has been removed by running the recommended 'npm ls @ngtools/webpack' - it should only show the version you installed and not the previous one.
这篇关于错误:已安装多个@ ngtools/webpack软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!