Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] installing a package with incompatible peer dependencies and --force sometimes results in an inf. loop #7349

Open
2 tasks done
G-Rath opened this issue Apr 7, 2024 · 4 comments
Labels
Bug thing that needs fixing Priority 1 high priority issue

Comments

@G-Rath
Copy link
Contributor

G-Rath commented Apr 7, 2024

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

On testing-library/eslint-plugin-jest-dom@18afe30 doing npm i eslint@9 --force results in an inf. loop outputting:

npm WARN node_modules/eslint
npm WARN   peer eslint@"^6.0.0 || ^7.0.0 || >=8.0.0" from @eslint-community/eslint-utils@4.4.0
npm WARN   node_modules/@eslint-community/eslint-utils
npm WARN     @eslint-community/eslint-utils@"^4.2.0" from @typescript-eslint/utils@5.62.0
npm WARN     node_modules/@typescript-eslint/utils
npm WARN     1 more (eslint)
npm WARN   17 more (@typescript-eslint/eslint-plugin, ...)
npm WARN 
npm WARN Could not resolve dependency:

Related PR: testing-library/eslint-plugin-jest-dom#355

Expected Behavior

The install to complete fine, since I've --force'd it

Steps To Reproduce

  1. Clone https://github.com/testing-library/eslint-plugin-jest-dom
  2. Run npm i eslint@9 --force
  3. Get stuck in a loop

(also see https://github.com/testing-library/eslint-plugin-jest-dom/actions/runs/8586049626/job/23528114426?pr=355)

Environment

  • npm: 10.5.1
  • Node.js: v16.20.2 (also at least happens on 18 too)
  • OS Name: Ubuntu
  • System Model Name: -
  • npm config: -
; copy and paste output from `npm config ls` here
@G-Rath G-Rath added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels Apr 7, 2024
@G-Rath
Copy link
Contributor Author

G-Rath commented Apr 19, 2024

It seems that if I remove the explicit dependency on @typescript-eslint/parser then the inf. loop is resolved even though the same resulting version of @typescript-eslint/parser is installed due to child dependencies

@milaninfy milaninfy added Priority 1 high priority issue and removed Needs Triage needs review for next steps labels May 1, 2024
@milaninfy
Copy link
Contributor

milaninfy commented May 7, 2024

Reproduction steps:

  1. create a new project
{
  "name": "eslint-plugin-jest-dom",
  "version": "0.1.0",
  "dependencies": {
    "@typescript-eslint/parser": "^5.9.1",
    "eslint": "^9.2.0",
    "kcd-scripts": "^12.0.0"
  }
}
  1. npm install --force
  2. npm install eslint@9 --force
  3. see the infinite logs

@wraithgar
Copy link
Member

wraithgar commented May 10, 2024

Tested against latest and this is no longer happening w/ the example repo. This was fixed by #7499

Sorry, missed the eslint@9 step. This is still happening.

@wraithgar wraithgar reopened this May 10, 2024
@Santoshraj2 Santoshraj2 self-assigned this May 22, 2024
@Santoshraj2
Copy link
Contributor

The issue is in build-ideal-tree.js the buildDepStep() function is basically have code to check depsQueue if the queue has some dependency, it is recursively calling buildDepStep().. In this scenario the queue is never getting empty because of which it is going in infinite loop.
Since it’s not resolving proper dependency it keeps on adding. We need to find some break conditions if someone is using --force in command.

@Santoshraj2 Santoshraj2 removed their assignment Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 1 high priority issue
Projects
None yet
Development

No branches or pull requests

5 participants