![](/img/trans.png)
[英]angular: An unhandled exception occurred: Cannot find module 'webpack'?
[英]Angular : An unhandled exception occurred: Cannot find module 'webpack/lib/ParserHelpers'
首先,確保 NPM 是最新的。
npm i -g npm
檢查 Webpack 的版本。 @angular-devkit/build-angular@0.8XX.X ( source ) 目前不支持第 5 版(及之后)。
清潔所有:
刪除 node_modules 文件夾和 package-lock.json 文件
rm package-lock.json && rm -R node_modules
刪除 dist 文件夾
清除 npm 緩存:
npm cache clean --force
要查看安裝了哪個版本:
npm ls webpack
如何解決?
npm uninstall webpack
npm install --save-dev webpack@4.39.2
在我的情況下它已經解決了
npm 審計修復 / sudo npm 審計修復 (ubuntu)
在 tsconfig.json "angularCompilerOptions" 中添加以下代碼: { "enableIvy": false }
你可以使用 npm ci
你應該在 Package-lock.json 和 package.json 中檢查你的 webpack 版本
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.