cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] Cannot install @angular/[email protected] alongside [email protected]

Open maleetz opened this issue 3 weeks ago • 0 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

This issue exists in the latest npm version

  • [x] I am using the latest npm

Current Behavior

Using this package.json npm i fails with below error message.

package.json:

{
  "name": "angular-package-install-test",
  "version": "1.0.0",
  "description": "npm i fails with these dependencies",
  "dependencies": {
    "@angular/platform-browser-dynamic": "19.2.9",
    "jest-preset-angular": "14.4.2"
  }
}

Error Message:

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: [email protected]
npm error Found: @angular/[email protected]
npm error node_modules/@angular/compiler
npm error   peer @angular/compiler@"19.2.17" from @angular/[email protected]
npm error   node_modules/@angular/compiler-cli
npm error     peer @angular/compiler-cli@">=15.0.0 <20.0.0" from [email protected]
npm error     node_modules/jest-preset-angular
npm error       jest-preset-angular@"14.4.2" from the root project
npm error
npm error Could not resolve dependency:
npm error peer @angular/compiler@"19.2.9" from @angular/[email protected]
npm error node_modules/@angular/platform-browser-dynamic
npm error   @angular/platform-browser-dynamic@"19.2.9" from the root project
npm error   peer @angular/platform-browser-dynamic@">=15.0.0 <20.0.0" from [email protected]
npm error   node_modules/jest-preset-angular
npm error     jest-preset-angular@"14.4.2" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.

Observations

If I install [email protected] by itself, npm resolves @angular/[email protected] instead of the latest 19.x.x version. The peerDependencies for jest-preset-angular should be pulling the latest 19.x.x version as far as I can tell.

  "peerDependencies": {
    "@angular/compiler-cli": ">=15.0.0 <20.0.0",
    "@angular/core": ">=15.0.0 <20.0.0",
    "@angular/platform-browser-dynamic": ">=15.0.0 <20.0.0",
    "jest": "^29.0.0",
    "typescript": ">=4.8"
  },

npm list @angular/platform-browser-dynamic

└─┬ [email protected]
  └── @angular/[email protected]

npm list @angular/compiler

└─┬ [email protected]
  ├─┬ @angular/[email protected]
  │ └── @angular/[email protected] invalid: "19.2.9" from node_modules/@angular/platform-browser-dynamic
  └─┬ @angular/[email protected]
    └── @angular/[email protected] deduped invalid: "19.2.9" from node_modules/@angular/platform-browser-dynamic

npm error code ELSPROBLEMS

Expected Behavior

I would expect npm i to install the dependencies successfully.

Steps To Reproduce

  1. In this environment (Node v25.2.1, MacOS 15.7.2 (24G325))
  2. With this config:
{
  "name": "angular-package-install-test",
  "version": "1.0.0",
  "description": "npm i fails with these dependencies",
  "dependencies": {
    "@angular/platform-browser-dynamic": "19.2.9",
    "jest-preset-angular": "14.4.2"
  }
}
  1. Run npm i
  2. See error (shown above)

Environment

  • npm: 11.6.2
  • Node.js: v25.2.1
  • OS Name: MacOS 15.7.2 (24G325)
  • System Model Name: MacBook Pro

maleetz avatar Dec 06 '25 01:12 maleetz