Skip to content

[pnpm] Angular cli cannot build angular 19 project in pnpm monorepo with both angular version 18 and 19 #29504

Closed

Description

@DrGrognon

Command

build, test

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

18

Description

Before angular 19 it was possible to have multiple versions of angular each one using it's version of angular-cli in a typical pnpm monorepo.
This was really convenient for migration project-by-project.

It's not working anymore, with a v18 and v19 mix. As any build/test command on angular project will issue the following error.

Minimal Reproduction

I got a minimal reproducible example with a really simple pnpm monorepo initiated from scratch. (https://github.com/DrGrognon/angular-pnpm-monorepo-v18-and-19)

Can be redone easily:
pnpm init
add angular projects with:

pnpx @angular/cli@19 new --package-manager pnpm ng-19 --skip-install
pnpx @angular/cli@18 new --package-manager pnpm ng-18 --skip-install

then create a pnpm-workspace.yaml file with projects:

packages:
  - 'ng-18'
  - 'ng-19'

Then reproduce with:

pnpm install
cd ng-19
pnpm run build

Exception or Error

> ng build

This version of CLI is only compatible with Angular versions ^18.0.0,
but Angular version 19.1.3 was found instead.
Please visit the link below to find instructions on how to update Angular.
https://update.angular.dev/
 ELIFECYCLE  Command failed with exit code 3.

Your Environment

In ng-18 project:

Angular CLI: 18.2.12
Node: 18.20.3
Package Manager: pnpm 9.11.0
OS: linux x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.12
@angular-devkit/build-angular   18.2.12
@angular-devkit/core            18.2.12
@angular-devkit/schematics      18.2.12
@angular/cli                    18.2.12
@schematics/angular             18.2.12
rxjs                            7.8.1
typescript                      5.5.4
zone.js                         0.14.10


In ng-19 project:

Angular CLI: 19.1.4
Node: 18.20.3
Package Manager: pnpm 9.11.0
OS: linux x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1901.4
@angular-devkit/build-angular   19.1.4
@angular-devkit/core            19.1.4
@angular-devkit/schematics      19.1.4
@angular/cli                    19.1.4
@schematics/angular             19.1.4
rxjs                            7.8.1
typescript                      5.7.3
zone.js                         0.15.0

Anything else relevant?

I tested the exact same configuration with 17/18 and 17/19 and everything was working fine.
It look like a strange 18/19 interaction 🤔

This issue is a continuation of angular/angular#58832 (closed for inactivity)
I encounter the exact same problem so i open another issue .
Please let me know if there is another process in this situation.

kudos to angular team, you do awesome work 💓

Activity

  1. added
    freq1: low
    on Jan 28, 2025
  2. added 2 commits that reference this issue on Jan 28, 2025
    221f14f
    2f196d6
  3. added a commit that references this issue on Jan 28, 2025
    0ddf6aa
  4. DrGrognon commented on Jan 28, 2025

    @DrGrognon
    Author

    Whooo that's like the fastest fix ever 😆 !!!

  5. alan-agius4 commented on Jan 28, 2025

    @alan-agius4
    Collaborator

    This will be available in 19.2.0-next.1 which should be released tomorrow on NPM.

  6. DrGrognon commented on Jan 30, 2025

    @DrGrognon
    Author

    FYI I made a test changing @angular-devkit/build-angular dependency to the new one : 19.2.0-next.1
    This solved the issue, now serve/build/test work perfectly 👌

    Thanks a lot for your quick fix 🙏 (And thanks to all the team for your amazing work on angular !)
    Let's go to angular 19 now ! yepeee 🥳

  7. alan-agius4 commented on Jan 30, 2025

    @alan-agius4
    Collaborator

    @DrGrognon glad to hear that the change resolved your issue. 😀

  8. angular-automatic-lock-bot commented on Mar 2, 2025

    @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.

  9. locked and limited conversation to collaborators on Mar 2, 2025
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

    area: @angular/buildfreq1: lowseverity3: brokentype: bug/fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions