Repository navigation
ng build never exits when using an incompatible version of TypeScript聽#23233
Copy link
Copy link
Closed
Labels
area: @ngtools/webpackfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity5: regressiontype: bug/fix
Milestone
Description
馃悶 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?
Can't remember
Description
When using a incompatible version of TypeScript, ng build displays an error, but keeps running forever without exiting.
This is particularly problematic on the CI, when using tools like renovate which send PRs upgrading the version of TypeScript, and the build consumes precious minutes of CI doing nothing until it finally times out.
馃敩 Minimal Reproduction
- run
ng newto create a new project - edit the package.json file and change the typescript version to 4.7.2
- run
npm install - run ng build
- the command never exits
馃敟 Exception or Error
The error being displayed (but not causing the process to exit) is
(node:86326) UnhandledPromiseRejectionWarning: Error: The Angular Compiler requires TypeScript >=4.4.2 and <4.7.0 but 4.7.2 was found instead.
at checkVersion (file:///Users/jb/tmp/tscheck/node_modules/@angular/compiler-cli/bundles/chunk-4MML3U2F.js:254:11)
at verifySupportedTypeScriptVersion (file:///Users/jb/tmp/tscheck/node_modules/@angular/compiler-cli/bundles/chunk-4MML3U2F.js:258:3)
at new NgtscProgram (file:///Users/jb/tmp/tscheck/node_modules/@angular/compiler-cli/bundles/chunk-4MML3U2F.js:7235:7)
at AngularWebpackPlugin.updateAotProgram (/Users/jb/tmp/tscheck/node_modules/@ngtools/webpack/src/ivy/plugin.js:327:32)
at /Users/jb/tmp/tscheck/node_modules/@ngtools/webpack/src/ivy/plugin.js:204:24
at Hook.eval [as call] (eval at create (/Users/jb/tmp/tscheck/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:20:1)
at Hook.CALL_DELEGATE [as _call] (/Users/jb/tmp/tscheck/node_modules/tapable/lib/Hook.js:14:14)
at Compiler.newCompilation (/Users/jb/tmp/tscheck/node_modules/webpack/lib/Compiler.js:1108:30)
at /Users/jb/tmp/tscheck/node_modules/webpack/lib/Compiler.js:1153:29
at eval (eval at create (/Users/jb/tmp/tscheck/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:31:1)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:86326) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:86326) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
馃實 Your Environment
Angular CLI: 13.3.7
Node: 14.18.1
Package Manager: npm 6.14.15
OS: darwin x64
Angular: 13.3.10
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1303.7
@angular-devkit/build-angular 13.3.7
@angular-devkit/core 13.3.7
@angular-devkit/schematics 13.3.7
@angular/cli 13.3.7
@schematics/angular 13.3.7
rxjs 7.5.5
typescript 4.7.2
Anything else relevant?
Nope
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: @ngtools/webpackfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity5: regressiontype: bug/fix
Activity
georgegoldman commentedon Jun 1, 2022
change typescript version in your package.json file to 4.4.2 which is the favourable version for you program to run.
jnizet commentedon Jun 1, 2022
@georgegoldman I know what I must do to fix the error, that's not the issue. The issue is that, when there is such an error, the process should exit rather than run forever.
georgegoldman commentedon Jun 1, 2022
@jnizet you are right but your promise is not properly resolved.. implement a catch or .catch at the end of your promise.
jnizet commentedon Jun 1, 2022
@georgegoldman it's not my promise. It's a promise in the Angular CLI. That's precisely why I submit an issue: in order for the Angular CLI to handle this promise better.
georgegoldman commentedon Jun 1, 2022
@jnizet yes very correct the thing is that you will have to bring download your typescript version to angular compiler CLI specification else the error will continue to run, because it returns this error because of incompatibility base on the current build on angular compiler CLI and i think it is not a mistake on their part, instead i think there is no rigid support for you typescript version.
bsplosion commentedon Jun 8, 2022
@georgegoldman the OP understands that TypeScript needs to be aligned for compatibility.
What the OP is saying is that the Angular CLI failing to exit when there is an incompatible dependency is bad behavior. This is true. The build should exit, it shouldn't just hang until some timeout is reached.
The expected standard behavior would be to exit, and with a nonzero status code.
angular-automatic-lock-bot commentedon Jul 29, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.