[英]Angular : An unhandled exception occurred: Cannot find module 'webpack/lib/ParserHelpers'
I want to do an upgrade from Angular 7 to 8. I have installed @angular-devkit/build-angular@0.800.0, uninstalled et reinstalled node modules, but I always got this problem : Cannot find module 'webpack/lib/ParserHelpers' When I did npm fix audit I got another type of error which is : An unhandled exception occurred: Job name "..getProjectMetadata" does not exist.我想从 Angular 7 升级到 8。我已经安装了@angular-devkit/build-angular@0.800.0,卸载并重新安装了节点模块,但我总是遇到这个问题:找不到模块'webpack/lib/ParserHelpers ' 当我进行 npm fix audit 时,我遇到了另一种类型的错误:发生未处理的异常:作业名称“..getProjectMetadata”不存在。 See "C:\\Users\\Surface\\AppData\\Local\\Temp\\ng-urmmUP\\angular-errors.log" for further details.
有关更多详细信息,请参阅“C:\\Users\\Surface\\AppData\\Local\\Temp\\ng-urmmUP\\angular-errors.log”。
First of all, make sure that NPM is up-to-date.首先,确保 NPM 是最新的。
npm i -g npm
Check version of Webpack.检查 Webpack 的版本。 The version 5 (and after) is not currently supported by @angular-devkit/build-angular@0.8XX.X ( source ).
@angular-devkit/build-angular@0.8XX.X ( source ) 目前不支持第 5 版(及之后)。
Clean all :清洁所有:
remove node_modules folder and package-lock.json file删除 node_modules 文件夹和 package-lock.json 文件
rm package-lock.json && rm -R node_modules
remove dist folder删除 dist 文件夹
Clear npm cache :清除 npm 缓存:
npm cache clean --force
To see which version are installed :要查看安装了哪个版本:
npm ls webpack
How to resolve ?如何解决?
npm uninstall webpack
npm install --save-dev webpack@4.39.2
In my case it has been solved在我的情况下它已经解决了
npm audit fix / sudo npm audit fix (ubuntu) npm 审计修复 / sudo npm 审计修复 (ubuntu)
Adding the following code in tsconfig.json "angularCompilerOptions": { "enableIvy": false }在 tsconfig.json "angularCompilerOptions" 中添加以下代码: { "enableIvy": false }
you can use npm ci你可以使用 npm ci
你应该在 Package-lock.json 和 package.json 中检查你的 webpack 版本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.