How to fix error upgrading to Angular 13: unhandled exception occurred: Cannot find module 'webpack'

I got this error upgrading from Angular 11 to Angular 13. This is the fix, run this in your terminal

rm package-lock.json
rm node_modules
rm dist 

npm cache clean --force
npm install