Skip to content

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

Closed
@DrGrognon

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 💓

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions