-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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] Infinite loop installing a package in a workspace #3385
Comments
I can still reproduce with npm 7.17.0. |
I can still reproduce with npm 7.18.1 |
I can still reproduce with npm 7.19.0 |
Any idea what's the cause of that? having the same issue on 7.19.0 as well |
Our team is hitting this issue too with workspaces. We have a checked-in |
I can still reproduce with npm 7.19.1 |
Having the same issue. |
Not sure if this helps anyone but I was able to resolve my issue by (a) making sure all package versions matched across all workspaces (b) bisecting my dependencies (deleting half of the dependencies, rerunning npm install, repeat, until success). I found through this process that the offending package was graphql-hooks. When I removed just this package, npm install succeeded! So then I deleted the package-lock file, removed graphql-hooks, and ran an npm install to generate the lock file from scratch. Then added graphql-hooks back and npm install again. Now all packages work with successive npm install. I still think this a bad bug with npm 7/workspaces but I hope this helps someone. |
@ruyadorno I'm sorry for pinging you directly, but after more than a month, I lost hope that someone from the npm team would see this issue. |
no worries @targos! I'm sorry about the delay 😊 I'm not sure this is a workspaces issue and I'm more inclined to believe this is a peer dependencies failure, if I try running
This def needs some more debugging and digging to find the root cause. I know that @isaacs is in the middle of a larger peer dependencies refactor at the moment so it might be better to wait for that to be done before starting to tackle this bug. |
I have good news, bad news, and a workaround. the good newsThe good news is that I have a fix for this already in the npm/arborist branch I'm working on where I'm refactoring the buildIdealTree method. So this does not trigger an infinite loop or fatal crash once that lands. It's almost done, I'm just finishing getting test coverage back up to 100%, and combing through the nitpicky issues that always come from that. But the bulk of it is done, and working already. the bad newsThe bad news is that, even with this fix, we end up creating a not-strictly-valid tree, because of this:
Then, it encounters a module that needs In general dependency-graph terms, you have something like this:
When resolving the tree, we try to place
Then we try to place The solution (obvious to meatbrains, because we're pretty great at NP-hard problems) is to roll back the workaroundThe workaround is that if you add |
Surprisingly I was able to successfully install packages using npm version 7.19.1. But as soon as I upgraded npm version to 7.24.0 it again stuck in infinite loop. |
This specific instance of @raut-rahul If you're having a similar problem, you can open a new issue. It's possible this is still happening in other cases (like #3787) but it's easier to debug in a new issue with a reproducible test case. |
Is there an existing issue for this?
Current Behavior
Running
npm install
in my repository without apackage-lock.json
file enters an infinite loop inside npm for a dependency in a workspace.Looping part of the logs with `--loglevel silly`
Expected Behavior
It should finish to install without errors. The behavior is correct if the dependency is not in a workspace.
Steps To Reproduce
git clone https://github.com/targos/npm-repro-infinite-loop.git
cd npm-repro-infinite-loop
npm install
Environment
The text was updated successfully, but these errors were encountered: