'node_modules/@angular/forms/forms.d.ts(2896,88): error TS1109: Expression expected

I tried to upgrade my angular version from 5.2 to 12. after updating to 12, I am seeing below isses while building the app.. I have tried lot of solutions but nothing is working. Could you please help me with this.

Full Error: node_modules/@angular-devkit/core/node_modules/ajv/dist/ajv.d.ts(1,38): error TS1005: ';' expected. node_modules/@angular-devkit/core/node_modules/ajv/dist/compile/codegen/code.d.ts(16,31): error TS1005: ';' expected. node_modules/@angular-devkit/core/node_modules/ajv/dist/compile/util.d.ts(4,44): error TS1005: ';' expected. node_modules/@angular-devkit/core/node_modules/ajv/dist/compile/validate/index.d.ts(1,13): error TS1005: '=' expected node_modules/@angular/core/core.d.ts(264,90): error TS1005: '(' expected. node_modules/@angular/compiler/src/ml_parser/tokens.d.ts(116,20): error TS1005: ',' expected. node_modules/@angular/forms/forms.d.ts(2896,87): error TS1005: ',' expected. node_modules/@angular/forms/forms.d.ts(2896,88): error TS1109: Expression expected.

below is my package.json

  "name": "***",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --configuration production",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/core": "12.2.16",
    "@angular-devkit/schematics": "^12.2.16",
    "@angular/animations": "^12.2.16",
    "@angular/cdk": "12.2.13",
    "@angular/common": "12.2.16",
    "@angular/compiler": "12.2.16",
    "@angular/core": "12.2.16",
    "@angular/flex-layout": "^12.0.0-beta.34",
    "@angular/forms": "12.2.16",
    "@angular/localize": "^12.2.16",
    "@angular/platform-browser": "^12.2.16",
    "@angular/platform-browser-dynamic": "^12.2.16",
    "@angular/platform-server": "^12.2.16",
    "@angular/router": "^12.2.16",
    "@fortawesome/angular-fontawesome": "^0.10.1",
    "@fortawesome/fontawesome-svg-core": "^6.1.0",
    "@fortawesome/free-solid-svg-icons": "^6.1.0",
    "@microsoft/applicationinsights-web": "^2.7.4",
    "ajv": "^8.10.0",
    "angular2-highcharts": "^0.5.5",
    "bootstrap": "^5.1.3",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.6.12",
    "crypto-js": "^3.3.0",
    "font-awesome": "^4.7.0",
    "install": "^0.13.0",
    "lodash": "^4.17.21",
    "moment": "^2.29.1",
    "ng-pick-datetime": "^7.0.0",
    "ng2-file-upload": "^1.4.0",
    "ngx-bootstrap": "7.1.2",
    "ngx-modal-dialog": "^4.0.0",
    "npm": "^8.5.4",
    "npm-shrinkwrap": "^6.1.0",
    "rxjs": "6.6.7",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.13.0",
    "@angular-eslint/builder": "1.2.0",
    "@angular-eslint/eslint-plugin": "1.2.0",
    "@angular-eslint/eslint-plugin-template": "1.2.0",
    "@angular-eslint/schematics": "1.2.0",
    "@angular-eslint/template-parser": "1.2.0",
    "@angular/compiler-cli": "^12.2.16",
    "@angular/language-service": "^12.2.16",
    "@fortawesome/fontawesome-free": "^5.15.4",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "^2.0.10",
    "@types/node": "~6.0.60",
    "@typescript-eslint/eslint-plugin": "^4.3.0",
    "@typescript-eslint/eslint-plugin-tslint": "^5.15.0",
    "@typescript-eslint/parser": "^4.3.0",
    "angular-virtual-list": "^0.2.3",
    "codelyzer": "^4.0.1",
    "eslint": "^7.32.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsdoc": "30.7.6",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "^6.3.17",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "^7.0.0",
    "rxjs-compat": "6.6.7",
    "ts-node": "~3.2.0",
    "typescript": "^4.3.5"
  }
}

please help me



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source