Skip to content

ng update adds a fake dependency/package #30374

Open
@ChrisMBarr

Description

@ChrisMBarr

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

I have a monorepo with several angular apps, and I added an NPM script to run ng update for me. I made a script on the root monorepo level to run the script on all of the child applications. When I do this, it always seems to ADD a fake dependency to each of the app package.json files which is the name of that project

Minimal Reproduction

On the root level package I have this NPM script

"update-angular-apps": "npm run update-angular --prefix ./app-1 && npm run update-angular --prefix ./app-2 && npm run update-angular --prefix ./app-3",

And here is what the individual app package files look like

{
  "name": "name-of-app-2",
  "private": true,
  "author": "Me",
  "description": "My App #2",
  "homepage": "https://company.com/app-2",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/redacted/app-2.git"
  },
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "update-angular": "ng update @angular/cli @angular/core @angular/material --allow-dirty",
    "lint": "ng lint --fix --max-warnings=0",
  },
  "dependencies": {
    "@angular/animations": "^19.2.12",
    "@angular/cdk": "^19.2.17",
    "@angular/common": "^19.2.12",
    "@angular/compiler": "^19.2.12",
    "@angular/core": "^19.2.12",
    "@angular/forms": "^19.2.12",
    "@angular/material": "^19.2.17",
    "@angular/platform-browser": "^19.2.12",
    "@angular/platform-browser-dynamic": "^19.2.12",
    "@angular/router": "^19.2.12",
    "@angular/service-worker": "^19.2.12",
    "zone.js": "^0.15.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^19.2.13",
    "@angular/cli": "^19.2.13",
    "@angular/compiler-cli": "^19.2.12"
  },
  "peerDependencies": {
    "rxjs": "*",
    "typescript": "*"
  }
}

From the root level I run npm run update-angular-apps and it modifies the package.json files with all the correct updates, and then after a little bit of time it adds a fake package to dependencies as a final step. It is formatted like

"name-of-app-2": "file:"

and I have to manually delete this and re-run npm install on each child application since it does add an entry to the package-lock.json file for this as well

Exception or Error


Your Environment

Angular CLI: 19.2.13
Node: 22.14.0
Package Manager: npm 10.9.1
OS: win32 x64

Angular: 19.2.12
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
... service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1902.13
@angular-devkit/build-angular     19.2.13
@angular-devkit/core              19.2.13
@angular-devkit/schematics        19.2.13
@angular/cdk                      19.2.17
@angular/cli                      19.2.13
@angular/material                 19.2.17
@angular/material-luxon-adapter   19.2.17
@schematics/angular               19.2.13
zone.js                           0.15.0

Anything else relevant?

The root package does NOT have any Angular packages installed on it, only the child apps have them. I'm not sure if this would matter or not. I mean, the upgrades do all work, it just adds some nonsense that I have to remove each time

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: repro stepsWe cannot reproduce the issue with the information given

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions