Skip to content

ng build hangs without error or warning. #27565

Closed

Description

@mvdluit

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

Raising this issue on behalf of @TheBarenziah (question was originally asked on discord: https://discord.com/channels/748677963142135818/1234862759502549163)

Running ng build hangs without showing any errors or warnings. Running it with the --verbose flag results in the following output before it hangs: https://pastebin.com/4DTaaNXL (dist folder is not created even though verbose output shows (some of) the chunks).

No errors are shown in the codebase and ng serve and ng serve --configuration production work as expected.

Steps taken to debug the issue:

  • ran command on different machines.
  • removed package-lock.json before install to ensure correct package versions were installed.
  • tried with different version of node (latest version of node 18)
  • tried with downgrading Angular packages (fixed on 17.1.0)
  • removed any code referencing firebase/database (firebase database provider, database.service.ts and code referencing the service in register.component.ts) as that was added last. ng build worked before that, but was couple weeks ago since last tried.

The absence of errors/warnings makes this hard to debug and I unfortunately do not have the ability to step through the different build steps to isolate the issue.

Minimal Reproduction

Repository: https://github.com/TheBarenziah/neuro-recovery-app (firebase api key will be replaced once issue is resolved, no data in database)

  • clone
  • npm install
  • ng build or ng build --verbose

Exception or Error

No response

Your Environment

Angular CLI: 17.3.6
Node: 20.11.1
Package Manager: npm 10.2.4
OS: linux x64

Angular: 17.3.6
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, material, platform-browser, platform-browser-dynamic
... platform-server, router, ssr

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.6
@angular-devkit/build-angular   17.3.6
@angular-devkit/core            17.3.6
@angular-devkit/schematics      17.3.6
@angular/fire                   17.0.1
@schematics/angular             17.3.6
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.4

Anything else relevant?

No response

Activity

  1. alan-agius4 commented on May 2, 2024

    @alan-agius4
    Collaborator

    In this scenario, the application isn't becoming stable, preventing prerendering from finishing. This seems to be caused by the following code:

      ngOnInit(): void {
        this.authService.user$.subscribe(user => {
          if (user) {
            this.authService.currentUserSig.set({
              email: user.email!,
              username: user.displayName!,
            });
          } else {
            this.authService.currentUserSig.set(null);
          }
          // console.log(this.authService.currentUserSig());
        });
      }
  2. mvdluit commented on May 2, 2024

    @mvdluit
    Author

    @alan-agius4 Thank you for taking a look. ng build is working as expected now after wrapping this code in ngOnInit in a AfterNextRender.

  3. JeanMeche commented on May 2, 2024

    @JeanMeche
    Member

    Couldn't the CLI display a warning when pre-rendereing a page takes more than 10s for example ?

    This would give some insights on the issue.

  4. reopened this on May 2, 2024
  5. mvdluit commented on May 2, 2024

    @mvdluit
    Author

    I agree that a warning would have been nice in this case, as we had no idea what/where the issue was.

  6. added a commit that references this issue on May 2, 2024
    b7bb2d3
  7. alan-agius4 commented on May 2, 2024

    @alan-agius4
    Collaborator

    I have added a workaround in #27579. However, this ideally should be handled by the framework which is being tracked here: angular/angular#51549

  8. added 2 commits that reference this issue on May 2, 2024
    59b69f5
    b7a0792
  9. angular-automatic-lock-bot commented on Jun 2, 2024

    @angular-automatic-lock-bot

    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.

  10. locked and limited conversation to collaborators on Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions