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

fix(install): don't re-set up node_modules if running lifecycle script #26984

Merged

Conversation

nathanwhit
Copy link
Member

@nathanwhit nathanwhit commented Nov 21, 2024

Fixes #26904

If using nodeModulesDir: "auto", it's possible for the lifecycle script subprocess to try to set up the node_modules dir (despite the fact that we're already doing that). If it does that, it hangs trying to acquire the file lock on the node_modules dir.

As a fix, don't try to set up node_modules if we're running as part of a lifecycle script.

Ideally we'd have better control over when we do and don't set up node_modules automatically (that's the underlying problem behind #25782 as well)

Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Is there a way we can get lifecycle scripts to show their output so that we could test this?

@nathanwhit
Copy link
Member Author

Tried writing a test, but can't reproduce the issue consistently 😕 (Now I can't even repro it on the original issue, though I definitely could before). It seems to be timing dependent

@nathanwhit nathanwhit merged commit a750314 into denoland:main Nov 26, 2024
17 checks passed
@nathanwhit nathanwhit deleted the lifecycle-scripts-auto-reentrant branch November 26, 2024 23:29
bartlomieju pushed a commit that referenced this pull request Nov 28, 2024
#26984)

Fixes #26904

If using `nodeModulesDir: "auto"`, it's possible for the lifecycle
script subprocess to try to set up the node_modules dir (despite the
fact that we're already doing that). If it does that, it hangs trying to
acquire the file lock on the node_modules dir.

As a fix, don't try to set up node_modules if we're running as part of a
lifecycle script.

Ideally we'd have better control over when we do and don't set up
node_modules automatically (that's the underlying problem behind #25782
as well)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deno install --allow-scripts indefinitely stuck on - [email protected]: running 'postinstall' script
2 participants