Home > Enterprise >  Cannot install ngx-graph with Angular 13.3
Cannot install ngx-graph with Angular 13.3

Time:04-02

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: [email protected]
npm ERR! Found: [email protected]
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/[email protected]
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/[email protected]
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/[email protected]
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.

CodePudding user response:

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.

  • Related