ni / javascript-styleguide

JavaScript and TypeScript Style Guide
MIT License
9 stars 9 forks source link

npm fails to resolve conditional dependencies #131

Closed TrevorKarjanis closed 9 months ago

TrevorKarjanis commented 10 months ago

Describe the issue Installing npm dependencies fails with the error below when upgrading @ni/eslint-config-angular to 5.1.0 from 5.0.4. The peer dependency @angular-eslint/schematics@^14.0.0 || ^15.0.0 has a peer dependency on @angular/cli@>= 15.0.0 < 16.0.0.

https://dev.azure.com/ni/DevCentral/_build/results?buildId=6676439&view=logs&j=c9f705c3-be38-5ef2-e7bb-7e9f088d41b7&t=590e11d1-985f-5b43-4bb9-d195b693a0fd

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: security@0.0.0
npm ERR! Found: @angular/cli@14.2.13
npm ERR! node_modules/@angular/cli
npm ERR!   dev @angular/cli@"^14.2.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/cli@">= 15.0.0 < 16.0.0" from @angular-eslint/schematics@15.2.1
npm ERR! node_modules/@angular-eslint/schematics
npm ERR!   peer @angular-eslint/schematics@"^14.0.0 || ^15.0.0" from @ni/eslint-config-angular@5.1.0
npm ERR!   node_modules/@ni/eslint-config-angular
npm ERR!     dev @ni/eslint-config-angular@"^5.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! 
npm ERR! For a full report see:
npm ERR! C:\Users\labviewbuild\AppData\Local\npm-cache\_logs\2023-11-02T22_11_14_506Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\labviewbuild\AppData\Local\npm-cache\_logs\2023-11-02T22_11_14_506Z-debug-0.log
##[warning]Couldn't find a debug log in the cache or working directory
##[error]Error: Npm failed with return code: 1

This is npm peer resolution issue 5. It is a known issue (angular-cli 22565, npm 3666). The force flag can be used, but I'm not sure how reasonable that is to use with Renovate.

TrevorKarjanis commented 10 months ago

npm install --force correctly resolves to @angular-eslint/schematics@14.4.0 even with no package lock. npm install @ni/eslint-config-angular@5.1.0 @angular-eslint/schematics@14.4.0 also works.