1

I spent hours reading about npm dependencies issues here, but I still don't really understand most dependencies error messages, they often don't really make sense and sometimes the dependency constraints should work with the version found.

For example, I still don't understand the error I have during a minor update of Angular (19.1 => 19.2) :

While resolving: [email protected]
Found: [email protected]
node_modules/rxjs
  rxjs@"7.8.2" from the root project
  rxjs@">=7.5.0" from @fronts/[email protected]
  node_modules/@fronts/ui-dynamic-components
    @fronts/ui-dynamic-components@"^24.295.2" from the root project
  peer rxjs@"^6.5.3 || ^7.4.0" from @angular/[email protected]
  node_modules/@angular/common
    @angular/common@"19.2.14" from the root project
    peer overridden @angular/common@"19.2.14" (was "^17.0.0 || ^16.0.0") from @fronts/[email protected]
    node_modules/@fronts/ui-dynamic-components
      @fronts/ui-dynamic-components@"^24.295.2" from the root project

Could not resolve dependency:
peer rxjs@"^6.5.3 || ^7.4.0" from @angular/[email protected]
node_modules/@angular/core
  @angular/core@"19.2.14" from the root project
  peer overridden @angular/core@"19.2.14" (was "^17.0.0 || ^16.0.0") from @fronts/[email protected]
  node_modules/@fronts/ui-dynamic-components
    @fronts/ui-dynamic-components@"^24.295.2" from the root project
  peer @angular/core@"19.2.14" from @angular/[email protected]
  node_modules/@angular/common
    @angular/common@"19.2.14" from the root project
    peer overridden @angular/common@"19.2.14" (was "^17.0.0 || ^16.0.0") from @fronts/[email protected]
    node_modules/@fronts/ui-dynamic-components
      @fronts/ui-dynamic-components@"^24.295.2" from the root project

Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

@fronts/ui-dynamic-components is an internal lib that I can't change which has Angular 16 & 17 as dependency, but we override it to Angular 19, as it still works:

  "overrides": {
    "@fronts/ui-dynamic-components": {
      "@angular/common": "$@angular/common",
      "@angular/core": "$@angular/core",
      "@angular/forms": "$@angular/forms",
      "@angular/platform-browser": "$@angular/platform-browser",
      "@angular-devkit/build-angular": "$@angular-devkit/build-angular"
    }
  }

What I understand from the message is that there are 2 libs that depend on rxjs:

The project has [email protected] defined.

What I don't understand, is that [email protected] should work with those constraints !
It satisfies rxjs@">=7.5.0" and rxjs@"^6.5.3 || ^7.4.0" I even tested it with https://semver.npmjs.com to be sure.

I don't like to use --force or --legacy-peer-deps because I don't like to ignore an error or a warning. Especially if I don't understand it.

Any tip on what is going on ? When is it "safe" to use --legacy-peer-deps ?

I'm using Node v22.19.0 and NPM v11.4.2

2
  • Could the issue be @fronts/ui-dynamic-components having @angular/core set to ^17.0.0 || ^16.0.0, but you have 19.2.14? Commented Aug 29 at 12:27
  • We override it. So far it seemed to work (this is a minor update from Angular 19.1 to 19.2). I added details about this to the question. Commented Aug 29 at 13:42

1 Answer 1

1

Sounds stupid but have you tried to:

  • Delete node_modules folder

  • Delete package-lock.json

  • npm cache clear -f

  • Install the deps again

I've checked it and in my angular 19 project i'm using

"rxjs": "7.8.1"

so you shouldn't have any issue with it. Keep me updated

For answer your second question about --legacy-peer-deps is never safe but if you test in another project and also reinstalling deps from scratch doesn't fix the warning, if you document that you got it and only after investigate there is not solution is fine to use it. Beside, this logic do not validate the use of --force that you can use only when if you are testing some latest version and not for prod.

Sign up to request clarification or add additional context in comments.

1 Comment

Did all of this, except cache clear. I just tried it. Same result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.