angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Node.js v22.2 causes ng build hangs up

Open lacolaco opened this issue 1 year ago • 4 comments

Command

build

Is this a regression?

  • [ ] Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When the Node.js version is v22.2.0 (released on 2024-05-15), the ng build command hangs up. Node.js v22.1.0 doesn't. Angular CLI is not supporting that version of Node.js officially, but on Firebase App Hosting, the build environment is using Node.js v22.2 today by default. So it is an easy situation for developers to get stumped.

My workaround is to set engines.node field in package.json as "20". App Hosting builder can determine the Node.js version to install.

Minimal Reproduction

  • set Node.js version to v22.2.0
  • ng new on @angular/cli@latest (v17.3.7)
  • ng build
  • print Building... and never finished.

Exception or Error

No response

Your Environment

Angular CLI: 17.3.7
Node: 22.2.0 (Unsupported)
Package Manager: pnpm 8.15.6
OS: darwin arm64

Angular: 17.3.9
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.7
@angular-devkit/build-angular   17.3.7
@angular-devkit/core            17.3.7
@angular-devkit/schematics      17.3.7
@angular/cli                    17.3.7
@angular/ssr                    17.3.7
@schematics/angular             17.3.7
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.6
    
Warning: The current version of Node (22.2.0) is not supported by Angular.

Anything else relevant?

No response

lacolaco avatar May 22 '24 03:05 lacolaco

Does this repro using Angular 18 RCs?

JoostK avatar May 22 '24 07:05 JoostK

@JoostK Yes, it reproduces the same situation even after ng update @angular/core @angular/cli --next.

Angular CLI: 18.0.0-rc.3
Node: 22.2.0
Package Manager: pnpm 8.15.6
OS: darwin arm64

Angular: 18.0.0-rc.3
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, ssr

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1800.0-rc.3
@angular-devkit/build-angular   18.0.0-rc.3
@angular-devkit/core            18.0.0-rc.3
@angular-devkit/schematics      18.0.0-rc.3
@schematics/angular             18.0.0-rc.3
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.6

lacolaco avatar May 22 '24 07:05 lacolaco

Unfortunately, this is a regression introduced by Node.js, and it's not something we can address on our end. For more details, see: Node.js Issue #53097.

alan-agius4 avatar May 22 '24 09:05 alan-agius4

It seems that the "regression" was intentional from Node.js' perspective. Unfortunately, this breaking behaviour happened in a minor version of Node.js, We will need to put in some work to address it on our end as it's not as trivial to solve.

alan-agius4 avatar May 23 '24 12:05 alan-agius4

There has been a revert in Node.js that will fix this in their next release. See: https://github.com/nodejs/TSC/issues/1566#issuecomment-2143907186 for more information.

alan-agius4 avatar Jun 03 '24 06:06 alan-agius4

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.