title: Upgrade from Angular 8 to v12 causing "Generating browser application bundles (phase: setup)...TypeError: Cannot read property 'text' of undefined"
body: <p>I have been working on upgrading an angular app from v8 to v12. I have completed all the upgrade steps by going through each version. That all went pretty well. However, I am trying to run the project &quot;ng serve&quot; and I am getting a cryptic error compilation error message that I have not been able to figure out.</p>
  <p>Here is the error that ng serve is spitting out. I get the same error for ng build as well.</p>
  <hr />
  <pre>
  ⠋ Generating browser application bundles (phase: setup)...TypeError: Cannot read property 'text' of undefined
      at NodeObject.getText (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/typescript/lib/typescript.js:152697:31)
      at getRequiredModulePath (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:519:99)
      at Object.getImportsOfUmdModule (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:510:23)
      at UmdDependencyHost.extractImports (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/@angular/compiler-cli/ngcc/src/dependencies/umd_dependency_host.js:43:54)
      at UmdDependencyHost.DependencyHostBase.recursivelyCollectDependencies (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/@angular/compiler-cli/ngcc/src/dependencies/dependency_host.js:85:32)
      at UmdDependencyHost.DependencyHostBase.collectDependencies (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/@angular/compiler-cli/ngcc/src/dependencies/dependency_host.js:38:22)
      at DependencyResolver.getEntryPointWithDependencies (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/@angular/compiler-cli/ngcc/src/dependencies/dependency_resolver.js:75:22)
      at EntryPointCollector.walkDirectoryForPackages (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/entry_point_collector.js:47:52)
      at EntryPointCollector.walkDirectoryForPackages (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/entry_point_collector.js:75:103)
      at /Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/program_based_entry_point_finder.js:124:100
  /Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/@ngtools/webpack/src/ngcc_processor.js:139
              throw new Error(errorMessage + `NGCC failed${errorMessage ? ', see above' : ''}.`);
              ^
  
  Error: NGCC failed.
      at NgccProcessor.process (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/@ngtools/webpack/src/ngcc_processor.js:139:19)
      at /Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/@ngtools/webpack/src/ivy/plugin.js:129:27
      at Hook.eval [as call] (eval at create (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/tapable/lib/HookCodeFactory.js:19:10), :32:1)
      at Hook.CALL_DELEGATE [as _call] (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/tapable/lib/Hook.js:14:14)
      at Compiler.newCompilation (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/webpack/lib/Compiler.js:1043:30)
      at /Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/webpack/lib/Compiler.js:1088:29
      at Hook.eval [as callAsync] (eval at create (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/tapable/lib/HookCodeFactory.js:33:10), :22:1)
      at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/tapable/lib/Hook.js:18:14)
      at Compiler.compile (/Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/webpack/lib/Compiler.js:1083:28)
      at /Users/ericdeveloper/Development/ClientApps/TBVApp/node_modules/webpack/lib/Watching.js:200:19
  </pre>
  <hr />
  <p>I found another post that had a similar error. It said there was an issue with angular v12.2.12. I tried downgrading to v12.2.4 but it didn't help.</p>
  <p>Here is my package.json contents...</p>
  <pre>
  {
    "name": "fury",
    "version": "7.0.0",
    "scripts": {
      "ng": "ng",
      "start": "ng serve --ssl true --ssl-key ../../SSL/localhostdev.key --ssl-cert ../../SSL/localhostdev.crt --host 0.0.0.0 --disableHostCheck",
      "build": "node --trace-warnings ng build --prod",
      "test": "ng test",
      "lint": "ng lint",
      "e2e": "ng e2e",
      "buildtest": "node --trace-warnings & export NODE_OPTIONS=--max_old_space_size=8192 & ng build  --extract-css=false --configuration test --aot --outputHashing=all",
      "buildprod": "export NODE_OPTIONS=--max_old_space_size=8192 &  ng build  --extract-css=false --prod --aot --outputHashing=all",
      "memory": "set NODE_OPTIONS=--max_old_space_size=8192",
      "update:packages": "node wipe-dependencies.js && rm -rf node_modules && npm update --save-dev && npm update --save"
    },
    "private": true,
    "dependencies": {
      "@angular/animations": "~12.2.4",
      "@angular/cdk": "~12.2.4",
      "@angular/cli": "~12.2.4",
      "@angular/common": "~12.2.4",
      "@angular/compiler": "~12.2.4",
      "@angular/core": "~12.2.4",
      "@angular/flex-layout": "12.0.0-beta.34",
      "@angular/forms": "~12.2.4",
      "@angular/material": "~12.2.4",
      "@angular/platform-browser": "~12.2.4",
      "@angular/platform-browser-dynamic": "~12.2.4",
      "@angular/router": "~12.2.4",
      "@angular/youtube-player": "~12.2.4",
      "@cloudinary/angular": "^1.0.0-beta.11",
      "@cloudinary/angular-5.x": "^1.5.0",
      "@fortawesome/angular-fontawesome": "^0.9.0",
      "@fortawesome/fontawesome-svg-core": "^1.2.36",
      "@fortawesome/free-brands-svg-icons": "^5.15.4",
      "@fortawesome/free-solid-svg-icons": "^5.15.4",
      "@nebular/eva-icons": "8.0.0",
      "@ngx-translate/core": "^13.0.0",
      "@opentok/client": "^2.21.1",
      "@stripe/stripe-js": "^1.20.3",
      "@types/jquery": "^3.5.8",
      "@types/twilio-video": "^2.11.0",
      "@videojs/http-streaming": "^2.11.2",
      "angular-calendar": "^0.28.28",
      "angular-oauth2-oidc": "^12.1.0",
      "chart.js": "~3.6.0",
      "chart.piecelabel.js": "~0.15.0",
      "cloudinary-core": "^2.12.0",
      "core-js": "^3.19.0",
      "cors": "^2.8.5",
      "eva-icons": "^1.1.3",
      "hammerjs": "~2.0.8",
      "highlight.js": "~11.3.1",
      "install": "^0.13.0",
      "jquery": "^3.6.0",
      "jwt-decode": "^3.1.2",
      "lodash-es": "^4.17.21",
      "moment": "~2.29.1",
      "moment-timezone": "^0.5.33",
      "ng-zorro-antd": "^12.0.1",
      "ngx-audio-player": "^11.0.4",
      "ngx-bootstrap": "^7.1.0",
      "ngx-bootstrap-modal": "^2.0.1",
      "ngx-cookie-service": "^12.0.3",
      "ngx-countdown": "^12.0.1",
      "ngx-device-detector": "^2.1.1",
      "ngx-facebook": "^2.4.0",
      "ngx-image-cropper": "^5.0.1",
      "ngx-infinite-scroll": "^10.0.1",
      "ngx-perfect-scrollbar": "^10.1.1",
      "ngx-quill": "~14.3.0",
      "ngx-slick-carousel": "^0.5.1",
      "ngx-toasta": "^2.0.0",
      "normalize.css": "~8.0.1",
      "npm": "^8.1.2",
      "pusher-js": "^7.0.3",
      "quill": "^1.3.7",
      "reinstall": "^2.0.0",
      "rxjs": "^7.4.0",
      "safe-pipe": "^1.0.3",
      "screenfull": "~5.1.0",
      "signalr": "^2.4.2",
      "simplebar": "~5.3.6",
      "slick-carousel": "^1.8.1",
      "smoothscroll-polyfill": "^0.4.4",
      "store-js": "^2.0.4",
      "tslib": "^2.3.1",
      "twilio-video": "^2.18.1",
      "video.js": "^7.15.4",
      "videojs-overlay": "^2.1.5",
      "videojs-resume": "^0.3.2",
      "videojs-youtube": "^2.6.1",
      "webpack-dev-server": "^4.4.0",
      "zone.js": "~0.11.4"
    },
    "devDependencies": {
      "@angular-builders/custom-webpack": "^12.1.3",
      "@angular-devkit/build-angular": "~12.2.4",
      "@angular/cli": "~12.2.4",
      "@angular/compiler-cli": "~12.2.4",
      "@angular/language-service": "~12.2.4",
      "@schematics/angular": "~12.2.4",
      "@types/chart.js": "^2.9.34",
      "@types/jasmine": "^3.10.1",
      "@types/jasminewd2": "^2.0.10",
      "@types/lodash-es": "^4.17.5",
      "@types/node": "^16.11.6",
      "browser-sync": "^2.27.7",
      "codelyzer": "^6.0.2",
      "install-peers": "^1.0.3",
      "jasmine-core": "~3.10.1",
      "jasmine-spec-reporter": "~7.0.0",
      "karma": "~6.3.6",
      "karma-chrome-launcher": "~3.1.0",
      "karma-coverage-istanbul-reporter": "~3.0.3",
      "karma-jasmine": "~4.0.1",
      "karma-jasmine-html-reporter": "^1.7.0",
      "less": "^4.1.2",
      "less-plugin-clean-css": "^1.5.1",
      "protractor": "~7.0.0",
      "ts-node": "~10.4.0",
      "tslint": "~6.1.0",
      "typescript": "^4.3.5"
    }
  }
  
  </pre>
  <p>I have tried reinstalling all the node_modules, etc. Any ideas on how to get at this?</p>
  <p>Thanks for your help!</p>