2

I have an Angular v13.3 project in which I'm trying to install the v8.0.0 of ngx-graph. When I run the command

npm install @swimlane/ngx-graph --save

I get the following output.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: demo-ui@0.0.0
npm ERR! Found: rxjs@7.5.5
npm ERR! node_modules/rxjs
npm ERR!   rxjs@"~7.5.0" from the root project
npm ERR!   peer rxjs@"^6.5.3 || ^7.4.0" from @angular/core@13.3.1
npm ERR!   node_modules/@angular/core
npm ERR!     @angular/core@"~13.3.0" from the root project
npm ERR!     peer @angular/core@"10.x || 11.x || 12.x || 13.x" from @swimlane/ngx-graph@8.0.0
npm ERR!     node_modules/@swimlane/ngx-graph
npm ERR!       @swimlane/ngx-graph@"*" from the root project
npm ERR!     3 more (@angular/animations, @angular/cdk, @angular/common)
npm ERR!   2 more (@angular/cdk, @angular/common)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer rxjs@"6.x" from @swimlane/ngx-graph@8.0.0
npm ERR! node_modules/@swimlane/ngx-graph
npm ERR!   @swimlane/ngx-graph@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

I haven't used npm for a long time, so I'm not really sure what this means. It appears that the versions of rxjs that Angular and ngx-graph require are in conflict.

Nick A. Watts
  • 819
  • 10
  • 16

1 Answers1

6
npm install @swimlane/ngx-graph --save --legacy-peer-deps

a couple of versions ago, npm started automatically for peer deps. Use the above command to workaround that.

Wen W
  • 2,434
  • 1
  • 10
  • 15
  • This command is useful for @swinlane/ngx-charts – Odilbek Utamuratov Jul 08 '22 at 11:57
  • 1
    I got `Module not found: Error: Can't resolve '@angular/cdk/portal'` on `ng serve` when using `--legacy-peer-deps`. Installing `@angular/cdk@13` before installing `@swinlane/ngx-charts` worked. – Steffen Aug 01 '22 at 05:57