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(installl): make bin entries executable even if not put in node_modules/.bin #25873

Merged

Conversation

nathanwhit
Copy link
Member

@nathanwhit nathanwhit commented Sep 25, 2024

Fixes #25862.

npm only makes bin entries executable if they get linked into .bin, as we did before this PR. So this PR actually deviates from npm, because it's the only reasonable way to fix this that I can think of.


The reason this was broken in moment is the following:

Moment has dependencies on two typescript versions: 1.8 and 3.1

If you have two packages with conflicting bin entries (i.e. two typescript versions which both have a bin entry tsc), in npm it is non-deterministic and undefined which one will end up in .bin.

npm, due to implementation differences, chooses to put typescript 1.8 into the .bin directory, and so node_modules/typescript/bin/tsc ends up getting marked executable. We, however, choose typescript 3.2, and so we end up making node_modules/typescript3/bin/tsc executable.

As part of its tests, moment executes node_modules/typescript/bin/tsc. Because we didn't make it executable, this fails.

Since the conflict resolution is undefined in npm, instead of trying to match it, I think it makes more sense to just make bin entries executable even if they aren't chosen in the case of a conflict.

@nathanwhit nathanwhit changed the title fix(installl): Make bin entries executable even if not put in node_modules/.bin fix(installl): make bin entries executable even if not put in node_modules/.bin Sep 26, 2024
Copy link
Contributor

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

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

Great writeup of the issue! Didn't about this behaviour in npm and marking every bin entry as executable seems like the best solution as you outlined 👍

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

@nathanwhit nathanwhit merged commit 13c53d9 into denoland:main Sep 26, 2024
17 checks passed
@nathanwhit nathanwhit deleted the always-make-bin-entries-executable branch September 26, 2024 16:36
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 doesn't properly setup modules when used in moment
3 participants