Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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/[email protected], 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. See "C:\Users\Surface\AppData\Local\Temp\ng-urmmUP\angular-errors.log" for further details.enter image description here

like image 529
ghada Avatar asked Nov 07 '22 04:11

ghada


1 Answers

First of all, make sure that NPM is up-to-date.

npm i -g npm

Check version of Webpack. The version 5 (and after) is not currently supported by @angular-devkit/[email protected] (source).

Clean all :

remove node_modules folder and package-lock.json file

rm package-lock.json && rm -R node_modules

remove dist folder

Clear npm cache :

npm cache clean --force

To see which version are installed :

npm ls webpack

How to resolve ?

npm uninstall webpack
npm install --save-dev [email protected]
like image 79
jpmottin Avatar answered Nov 11 '22 12:11

jpmottin