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

`ng update` doesn't work with pnpm `catalog:` protocol

Open Bricklou opened this issue 7 months ago • 3 comments

Command

update

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

Our project is running on Angular 18 and we would like to migrate to 19. To do this, we tried to run the usual ng update but because of the usage of pnpm catalog protocol Angular CLI is unable to run the packages migration properly.

Minimal Reproduction

  • Setup an angular 18 project inside a pnpm workspace
  • Use pnpx codemod pnpm/catalog to move all dependencies in workspace catalog
  • Try to run ng update @angular/core@19 @angular/cli@19
  • See the actual error

Exception or Error

The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 19.2.14 to perform the update.
Using package manager: npm
Collecting installed dependencies...
Found 30 dependencies.
Fetching dependency metadata from registry...
    Package @angular-devkit/build-angular was not found on the registry. Skipping.
    Package @angular/cli was not found on the registry. Skipping.
    Package @angular/compiler-cli was not found on the registry. Skipping.
    Package esbuild was not found on the registry. Skipping.
    Package jasmine-core was not found on the registry. Skipping.
    Package typescript was not found on the registry. Skipping.
    Package @ale-rainbow/rainbow-components was not found on the registry. Skipping.
    Package rainbow-web-sdk was not found on the registry. Skipping.
    Package @angular/animations was not found on the registry. Skipping.
    Package @angular/common was not found on the registry. Skipping.
    Package @angular/compiler was not found on the registry. Skipping.
    Package @angular/core was not found on the registry. Skipping.
    Package @angular/forms was not found on the registry. Skipping.
    Package @angular/platform-browser was not found on the registry. Skipping.
    Package @angular/platform-browser-dynamic was not found on the registry. Skipping.
    Package @angular/router was not found on the registry. Skipping.
    Package @hono/node-server was not found on the registry. Skipping.
    Package chrome-launcher was not found on the registry. Skipping.
    Package chrome-remote-interface was not found on the registry. Skipping.
    Package hono was not found on the registry. Skipping.
    Package resize-observer-polyfill was not found on the registry. Skipping.
    Package rxjs was not found on the registry. Skipping.
    Package tslib was not found on the registry. Skipping.
    Package zone.js was not found on the registry. Skipping.
    Package not installed: "@angular/core". Skipping.
    We analyzed your package.json and everything seems to be in order. Good work!
✔ Cleaning node modules directory
✖ Unable to install packages

npm warn using --force Recommended protections disabled.
npm error code EUNSUPPORTEDPROTOCOL
npm error Unsupported URL Type "workspace:": workspace:*
npm error A complete log of this run can be found in: /home/xxx/.npm/_logs/2025-06-02T13_47_55_651Z-debug-0.log
 ELIFECYCLE  Command failed with exit code 1.
 WARN   Local package.json exists, but node_modules missing, did you mean to install?

Your Environment

Angular CLI: 18.2.19
Node: 20.17.0
Package Manager: npm 10.8.2
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.19
@angular-devkit/build-angular   18.2.19
@angular-devkit/core            18.2.13
@angular-devkit/schematics      18.2.19
@angular/cli                    18.2.19
@schematics/angular             18.2.19
rxjs                            7.8.2
typescript                      5.5.4
zone.js                         0.15.1

Anything else relevant?

No response

Bricklou avatar Jun 02 '25 13:06 Bricklou

I encountered the same on a project where yarn is used and fixed by setting it as the preferred package manager for the cli. Try setting "packageManager": "pnpm" in the cli section of angular.json.

caleniuc avatar Jul 05 '25 12:07 caleniuc

I do have this option configured and it still cause the issue.

Bricklou avatar Jul 08 '25 14:07 Bricklou

Hello. Up on this subject. Same issue here

pnpm needs flag --save-catalog. It does not save by default in catalog. Maybe the culprit lies there

wafelmolt avatar Nov 07 '25 12:11 wafelmolt