Reputation: 43
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.
Upvotes: 4
Views: 2171
Reputation: 68
Upvotes: 1
Reputation: 11230
This seems to be caused by the improved UMD module detection added in 12.2.11, pinning the version to 12.2.10 avoids the issue but doesn't address the root cause which is that a dependency probably needs updating.
For us, the package was @auth0/angular-jwt
, but it might be different for you. To find it we had to use Linux tool strace
to find out which file was opened just before the build failed:
strace -f npm run build 2>&1 | egrep 'open|Error'
(eventually) produced the output
[pid 29550] open(".../node_modules/@auth0/angular-jwt/package.json", O_RDONLY|O_CLOEXEC) = 19
[pid 29550] open(".../node_modules/@auth0/angular-jwt/bundles/core.umd.js", O_RDONLY|O_CLOEXEC) = 19
[pid 29550] open(".../node_modules/@auth0/angular-jwt/bundles/core.umd.js", O_RDONLY|O_CLOEXEC) = 19
[pid 29550] open(".../node_modules/@angular/compiler-cli/bundles/ngcc/__ngcc_lock_file__", O_RDONLY|O_CLOEXEC) = 19
[pid 29550] write(2, "TypeError: Cannot read property "..., 1535TypeError: Cannot read property 'text' of undefined
[pid 29582] open(".../node_modules/@angular/compiler-cli/bundles/ngcc/__ngcc_lock_file__", O_RDONLY|O_CLOEXEC <unfinished ...>
[pid 29582] <... open resumed> ) = -1 ENOENT (No such file or directory)
[pid 29393] write(2, "(node:29393) UnhandledPromiseRej"..., 914(node:29393) UnhandledPromiseRejectionWarning: Error: NGCC failed.
the offending module is opened in the run up to the error, and updating it resolved the problem. There's probably a more succinct shell command to get the error, but this was enough for us.
Upvotes: 0
Reputation: 76
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
Upvotes: 6