Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task done
DrGrognon opened this issue Jan 28, 2025 · 4 comments · Fixed by #29505
Closed
1 task done
Labels
area: @angular/build freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix

Comments

@DrGrognon
Copy link

DrGrognon commented Jan 28, 2025

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 💓

@alan-agius4 alan-agius4 added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity3: broken area: @angular/build labels Jan 28, 2025
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 28, 2025
…pendency versions

This update replaces the resolution of peer dependency versions with the use of the Bazel stamp for improved consistency and reliability.

Closes angular#29504
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 28, 2025
…pendency versions

This update replaces the resolution of peer dependency versions with the use of the Bazel stamp for improved consistency and reliability.

Closes angular#29504
@DrGrognon
Copy link
Author

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

@alan-agius4
Copy link
Collaborator

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

@DrGrognon
Copy link
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 🥳

@alan-agius4
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: @angular/build freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Projects
None yet
2 participants