Skip to content

TypeError: Cannot read property 'text' of undefined - Error: NGCC failed. #44019

@dabbabi

Description

@dabbabi

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 12.2.10

Description

After upgrading angular from version 12.2.10 to 12.2.11 or 12.2.12, I can't build anymore my project.

🔬 Minimal Reproduction

I attached a repo-app, under the project folder, run the follwoing to reproduce the error:


npm i
ng build

🔥 Exception or Error




- Generating browser application bundles (phase: setup)...TypeError: Cannot read property 'text' of undefined
    at NodeObject.getText (C:\Users\user\git\angular\repro-app\node_modules\typescript\lib\typescript.js:148615:31)
    at getRequiredModulePath (C:\Users\user\git\angular\repro-app\node_modules\@angular\compiler-cli\ngcc\src\host\umd_host.js:519:99)
    at Object.getImportsOfUmdModule (C:\Users\user\git\angular\repro-app\node_modules\@angular\compiler-cli\ngcc\src\host\umd_host.js:510:23)
    at UmdDependencyHost.extractImports (C:\Users\user\git\angular\repro-app\node_modules\@angular\compiler-cli\ngcc\src\dependencies\umd_dependency_host.js:43:54)
    at UmdDependencyHost.DependencyHostBase.recursivelyCollectDependencies (C:\Users\user\git\angular\repro-app\node_modules\@angular\compiler-cli\ngcc\src\dependencies\dependency_host.js:85:32)
    at UmdDependencyHost.DependencyHostBase.collectDependencies (C:\Users\user\git\angular\repro-app\node_modules\@angular\compiler-cli\ngcc\src\dependencies\dependency_host.js:38:22)
    at DependencyResolver.getEntryPointWithDependencies (C:\Users\user\git\angular\repro-app\node_modules\@angular\compiler-cli\ngcc\src\dependencies\dependency_resolver.js:75:22)
    at EntryPointCollector.walkDirectoryForPackages (C:\Users\user\git\angular\repro-app\node_modules\@angular\compiler-cli\ngcc\src\entry_point_finder\entry_point_collector.js:47:52)
    at EntryPointCollector.walkDirectoryForPackages (C:\Users\user\git\angular\repro-app\node_modules\@angular\compiler-cli\ngcc\src\entry_point_finder\entry_point_collector.js:75:103)
    at C:\Users\user\git\angular\repro-app\node_modules\@angular\compiler-cli\ngcc\src\entry_point_finder\program_based_entry_point_finder.js:124:100
C:\Users\user\git\angular\repro-app\node_modules\@ngtools\webpack\src\ngcc_processor.js:139
            throw new Error(errorMessage + `NGCC failed${errorMessage ? ', see above' : ''}.`);
            ^

Error: NGCC failed.
    at NgccProcessor.process (C:\Users\user\git\angular\repro-app\node_modules\@ngtools\webpack\src\ngcc_processor.js:139:19)
    at C:\Users\user\git\angular\repro-app\node_modules\@ngtools\webpack\src\ivy\plugin.js:129:27
    at Hook.eval [as call] (eval at create (C:\Users\user\git\angular\repro-app\node_modules\tapable\lib\HookCodeFactory.js:19:10), :20:1)
    at Hook.CALL_DELEGATE [as _call] (C:\Users\user\git\angular\repro-app\node_modules\tapable\lib\Hook.js:14:14)
    at Compiler.newCompilation (C:\Users\user\git\angular\repro-app\node_modules\webpack\lib\Compiler.js:1043:30)
    at C:\Users\user\git\angular\repro-app\node_modules\webpack\lib\Compiler.js:1088:29
    at Hook.eval [as callAsync] (eval at create (C:\Users\user\git\angular\repro-app\node_modules\tapable\lib\HookCodeFactory.js:33:10), :22:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\Users\user\git\angular\repro-app\node_modules\tapable\lib\Hook.js:18:14)
    at Compiler.compile (C:\Users\user\git\angular\repro-app\node_modules\webpack\lib\Compiler.js:1083:28)
    at C:\Users\user\git\angular\repro-app\node_modules\webpack\lib\Watching.js:200:19

🌍 Your Environment




Angular CLI: 12.2.12
Node: 14.18.1
Package Manager: npm 6.14.15
OS: win32 x64

Angular: 12.2.12
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, google-maps, language-service, localize, material
... platform-browser, platform-browser-dynamic, platform-server
... router, service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1200.5
@angular-devkit/build-angular     12.2.12
@angular-devkit/build-optimizer   0.1200.5
@angular-devkit/core              12.0.5
@angular-devkit/schematics        12.2.12
@nguniversal/builders             12.1.3
@nguniversal/express-engine       12.1.3
@schematics/angular               12.2.12
ng-packagr                        12.2.5
rxjs                              6.6.7
typescript                        4.2.4

Anything else relevant?

Kindly check below a zip of an angular-cli project to reproduce the error: repro-app.zip

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentstate: has PR

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions