我有一個 Angular v13.3 專案,我正在嘗試安裝 ngx-graph 的 v8.0.0。當我運行命令時
npm install @swimlane/ngx-graph --save
我得到以下輸出。
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.
我很久沒有使用 npm 了,所以我不太確定這是什么意思。Angular 和 ngx-graph 所需的 rxjs 版本似乎存在沖突。
uj5u.com熱心網友回復:
npm install @swimlane/ngx-graph --save --legacy-peer-deps
幾個版本前,npm 會自動為 peer deps 啟動。使用上面的命令來解決這個問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/455179.html
