angulartypescripttscangular-compilerangular-compiler-cli

Cannot read property 'text' of undefined at NodeObject.getText at getRequiredModulePath


Error occurs while generating browser application bundles (phase: setup). What can cause this error?

Info from console:

Generating browser application bundles (phase: setup)... TypeError: Cannot read property 'text' of undefined at NodeObject.getText (/opt/app-root/src/node_modules/typescript/lib/typescript.js:152697:31) at getRequiredModulePath (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:519:99) at Object.getImportsOfUmdModule (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/host/umd_host.js:510:23) at UmdDependencyHost.extractImports (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/dependencies/umd_dependency_host.js:43:54) at UmdDependencyHost.DependencyHostBase.recursivelyCollectDependencies (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/dependencies/dependency_host.js:85:32) at UmdDependencyHost.DependencyHostBase.collectDependencies (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/dependencies/dependency_host.js:38:22) at DependencyResolver.getEntryPointWithDependencies (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/dependencies/dependency_resolver.js:75:22) at EntryPointCollector.walkDirectoryForPackages (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/entry_point_collector.js:47:52) at EntryPointCollector.walkDirectoryForPackages (/opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/entry_point_collector.js:75:103) at /opt/app-root/src/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/program_based_entry_point_finder.js:124:100

Info from angular-errors.log

An error occurred during the build: Error: NGCC failed. at NgccProcessor.process (/opt/app-root/src/node_modules/@ngtools/webpack/src/ngcc_processor.js:139:19) at /opt/app-root/src/node_modules/@ngtools/webpack/src/ivy/plugin.js:129:27 at Hook.eval [as call] (eval at create (/opt/app-root/src/node_modules/tapable/lib/HookCodeFactory.js:19:10), :28:1) at Hook.CALL_DELEGATE [as _call] (/opt/app-root/src/node_modules/tapable/lib/Hook.js:14:14) at Compiler.newCompilation (/opt/app-root/src/node_modules/webpack/lib/Compiler.js:1043:30) at /opt/app-root/src/node_modules/webpack/lib/Compiler.js:1088:29 at Hook.eval [as callAsync] (eval at create (/opt/app-root/src/node_modules/tapable/lib/HookCodeFactory.js:33:10), :22:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/opt/app-root/src/node_modules/tapable/lib/Hook.js:18:14) at Compiler.compile (/opt/app-root/src/node_modules/webpack/lib/Compiler.js:1083:28) at /opt/app-root/src/node_modules/webpack/lib/Compiler.js:508:12 at Compiler.readRecords (/opt/app-root/src/node_modules/webpack/lib/Compiler.js:920:11) at /opt/app-root/src/node_modules/webpack/lib/Compiler.js:505:11 at Hook.eval [as callAsync] (eval at create (/opt/app-root/src/node_modules/tapable/lib/HookCodeFactory.js:33:10), :10:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/opt/app-root/src/node_modules/tapable/lib/Hook.js:18:14) at /opt/app-root/src/node_modules/webpack/lib/Compiler.js:502:20 at Hook.eval [as callAsync] (eval at create (/opt/app-root/src/node_modules/tapable/lib/HookCodeFactory.js:33:10), :22:1) An unhandled exception occurred: NGCC failed. See "/tmp/ng-IZbyMh/angular-errors.log" for further details.


Solution

  • There is a error in angular version 12.2.12 and 12.2.11 use 12.2.10 it will fix it or you might have to wait for them to release a new version or fix 12.2.12

    Note : if you are using ^12.0.1 in your package.json file, replace it with 12.2.10