0

npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @ng-idle/core@2.0.0-beta.15 npm ERR! Found: @angular/common@7.2.16 npm ERR! node_modules/@angular/common npm ERR! @angular/common@"^7.0.1" from the root project npm ERR! peer @angular/common@"^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0" from @agm/core@1.0.0 npm ERR! node_modules/@agm/core npm ERR! @agm/core@"1.0.0" from the root project npm ERR! 6 more (@angular/forms, @angular/platform-browser, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer @angular/common@"^4.0.0 || ^5.0.0" from @ng-idle/core@2.0.0-beta.15 npm ERR! node_modules/@ng-idle/core npm ERR! @ng-idle/core@"^2.0.0-beta.15" from the root project npm ERR! peer @ng-idle/core@"^2.0.0-beta.15" from @ng-idle/keepalive@2.0.0-beta.15 npm ERR! node_modules/@ng-idle/keepalive npm ERR! @ng-idle/keepalive@"^2.0.0-beta.15" from the root project npm ERR! npm ERR! Conflicting peer dependency: @angular/common@5.2.11 npm ERR! node_modules/@angular/common npm ERR! peer @angular/common@"^4.0.0 || ^5.0.0" from @ng-idle/core@2.0.0-beta.15 npm ERR! node_modules/@ng-idle/core npm ERR! @ng-idle/core@"^2.0.0-beta.15" from the root project npm ERR! peer @ng-idle/core@"^2.0.0-beta.15" from @ng-idle/keepalive@2.0.0-beta.15 npm ERR! node_modules/@ng-idle/keepalive npm ERR! @ng-idle/keepalive@"^2.0.0-beta.15" 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! npm ERR! For a full report see: npm ERR! C:\Users\objec\AppData\Local\npm-cache_logs\2023-06-14T07_17_12_068Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: C:\Users\objec\AppData\Local\npm-cache_logs\2023-06-14T07_17_12_068Z-debug-0.log

I'm first time in Angular. I couldn't run npm install. It showing my @ng-idle/core not supported to my angular, how to resolve this.

Abhinand K
  • 11
  • 3

1 Answers1

0

This is an NPM peer dependency issue. In summary, a peer dependency is where an installed NPM package relies on a host project containing a specific version of an installation of a package further downstream.

Your version of @ng-idle/core@"^2.0.0-beta.15 relies upon certain NPM Peer Dependancies.

To find what these are you can use the command as below.

npm info @ng-idle/core@2.0.0-beta.15 peerDependencies 

Result:

{
  '@angular/common': '^4.0.0 || ^5.0.0',
  '@angular/core': '^4.0.0 || ^5.0.0'
}

As you will see from the above result, your package is expecting @angular/common between v4 and v5.

You can ignore this message with the --legacy-peer-deps switch but obviously the version will probably not have been tested with other versions, which is why you get the error:

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.

Alternatively, try installing a compatible version of your package. For example you could try latest version.

Test before with:

npm info @ng-idle/core peerDependencies 

Resulting in an versions greater than or equal to v9.

{ '@angular/common': '>=9.0.0', '@angular/core': '>=9.0.0' }

Install latest verion as follows:

npm install @ng-idle/core@latest 

There is also a useful package you can use in a project to check for peer dependencies via npx.

npx check-peer-dependencies

Also this explains further: angular/compiler-cli peer dependencies

Robin Webb
  • 1,355
  • 1
  • 8
  • 15