Home > other >  Conflicting peer dependency Error with Node V18
Conflicting peer dependency Error with Node V18

Time:01-02

Does anyone have idea what this error is about ? I simply just try to install any dependency and this always pops up these days. I have no clue whats going on.

npm ERR!       1 more (the root project)
npm ERR!     peer @angular/platform-browser@"13.2.4" from @angular/[email protected]
npm ERR!     node_modules/@angular/platform-browser-dynamic
npm ERR!       peer @angular/platform-browser-dynamic@">=10.0.0" from [email protected]
npm ERR!       node_modules/jest-preset-angular
npm ERR!         dev jest-preset-angular@"11.1.1" from the root project
npm ERR!       1 more (the root project)
npm ERR!     2 more (@angular/router, the root project)
npm ERR!   7 more (@angular/platform-browser-dynamic, @angular/router, ...)
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!   @agm/core@"^1.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/common
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!     @agm/core@"^1.1.0" 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 ERR!
npm ERR! See XXXXXXX\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:

Id really appreciate your help

CodePudding user response:

@agm/core is unmaintaned and hasn't been updated since july 2020.

You 2 possibilities:

  • Try your luck by forcing the install with --force and test if it still works.
  • Choose another library that is still maintained.

CodePudding user response:

If you swiched to node18 from a previous node version clean first your environment.

rm -rf node_modules
rm package-lock.json // or yarn.lock if you are using yarn
npm cache verify
npm i

If the error still persist you have some modules or dependencies of some node modules you are using that are not compatible with node18.

In that case you can analyse from which the error comes and try a different version. But often this let you get in ohter problems, like older or deprecate version.

A good but timeconsuming method is:

  1. Create a new empty Angular project. It will install all needed and working Angular modules correctly.

  2. move your code from old project in the new one, without package.json

  3. Reinstall all node modules without version. If you get an error remember the module.

  4. If error occurs for some modules research if there are known issues.

  5. If no solution seems to be there, (should be only old not updated modules), look how you can substitued them.

  6. There is a good possibility that in newer modules, there are breaking changes and your code will not be executed. (Ex. names of methods changed, methods were removed)

Upgrading to a new node version is sometimes really stressfull.

  • Related