-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[BUG] running npm install
has nondeterministic behaviour and race conditions for packages with link references
#8201
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
Labels
Comments
This was referenced Apr 1, 2025
This does appear to work
|
Apologies - please ignore the below. I need to do more investigating...
Console logs (incorrect)
|
Seeing the same behavior as previously with the other days outtage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
This happens when a package ('packageA') has a link to a dependency bundled within itself ('packageB'). This results in a condition when reifying the tree where:
Because both packageA and packageB are installed in a Promise.all(), there is a race where either one of these can happen first, resulting in nondeterministic behaviour.
I discovered this as I was trying to fix #8199. This blocks us from erroring when a link target does not exist, because at the point of reifying we can't easily tell if the link target doesn't exist because it depends on another package, or because it just doesn't exist.
Expected Behavior
The packages should be installed probably in dependency order, e.g. if packageB is a local file and part of packageA, it should wait for packageA to complete installing.
OR
External packages relying on local file links should just not be supported as a feature, if it is too unstable/causes performance issues.
Steps To Reproduce
(notice that probably your
node_modules
will now not have alinked-dep
link, and this will have silently failed to create)npm install
(notice that probably your
node_modules
will now have alinked-dep
link)You can also then remove node_modules and run
npm install
multiple times to see the race condition.Environment
latest
branch)The text was updated successfully, but these errors were encountered: