While updating the angular from 10 to 12, I was following all the steps which are already written here
https://update.angular.io/?l=3&v=10.0-12.0
However after doing all these steps properly, here are the errors I am getting:
An unhandled exception occurred: Must use import to load ES Module:
/home/../angular/node_modules/@angular/compiler-cli/bundles/index.js
require() of ES modules is not supported.
require() of /home/../angular/node_modules/@angular/compiler-cli/bundles/index.js from /home/../angular/node_modules/@angular-devkit/build-angular/src/webpack/configs/common.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/../angular/node_modules/@angular/compiler-cli/package.json.
I could not understand how to fix it. I tried to remove "type": "module" from /home/../angular/node_modules/@angular/compiler-cli/package.json but it did not solve my problem.
I will so glad if someone helps me solve this issue