How to fix Angular 13 (peer) dependency error on npm install?
Asked Answered
T

1

9

I'm developing a Angular component library and since the update to Angular 13 we have some errors during npm i @our/[email protected] of our library:

npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"~13.2.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^6.0.0 || ^7.0.0 || ^8.0.0" from @agm/[email protected]
npm ERR! node_modules/@agm/core
npm ERR!   peer @agm/core@"^1.1.0" from @our/[email protected]
npm ERR!   node_modules/@our/library
npm ERR!     @our/library@"14.1.1-beta.1" from the root project

So it seems to me that @agm/[email protected] has @angular/common@"^6.0.0 || ^7.0.0 || ^8.0.0" as a dependency which is not compatible with @angular/common@"~13.2.0". Is that correct?

I tried to add @angular/[email protected] as a dependency to our library, but that didn't do a thing, the error on install still exists.

Install works with the --legacy-peer-deps flag but it sounds like that is not the correct way to install. I use npm v8.5.0 and node v14.18.2.

So is there a solution for that apart deleting @agm/core and use something different?

Tratner answered 18/3, 2022 at 15:0 Comment(0)
C
-3

Running npm install --legacy-peer-deps will fix an error. Actually, some of the dependencies are not compatible with the newer/older angular versions. Installing peer deps install the necessary dependency to work. It installs a dependency locally for the particular plugin, not for the application.

Crumhorn answered 18/3, 2022 at 16:25 Comment(2)
Hi, How do you do for build:prod... for you FTP enterprise... ? -_- npm install --force ....Intolerant
Please do not post comments/answers that leads to more problems than solutions. Force flag is never recommended.Bouquet

© 2022 - 2024 — McMap. All rights reserved.