Home > Net >  Dependency error while trying to add another one in angular
Dependency error while trying to add another one in angular

Time:12-21

while trying to add new package this error message displaying. I dont know what is wrong I have updated the angular and packages. How to fix this dependency broken error ?

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @ng-bootstrap/[email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR!   peer @angular/common@"^13.0.0 || ^14.0.0-0" from @angular/[email protected]
npm ERR!   node_modules/@angular/cdk
npm ERR!     peer @angular/cdk@"13.3.7" from @angular/[email protected]
npm ERR!     node_modules/@angular/material
npm ERR!       @angular/material@"^13.3.7" from the root project
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 ERR!
npm ERR! See C:\Users\nizal\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\nizal\AppData\Local\npm-cache\_logs\2022-12-21T09_02_27_026Z-debug-0.log

CodePudding user response:

Looks like you're trying to install the wrong version of ng-bootstrap (12.x.x) against the version of your angular project (14.x.x). As per the official documentation for the package, you should be installing [email protected].

The package version 12.x.x is trying to find the angular version it supports but is getting a different version, hence the error.

The two possible solutions are - either bumping the package version to 13.x.x or downgrading your angular version in the project to 13.x.x.

CodePudding user response:

Have you tried to run the npm install with --legacy-peer-deps command? It might be an issue with the peer dependencies in npm's latest version.

  • Related