fix(installl): make bin entries executable even if not put in node_modules/.bin
#25873
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 sonode_modules/typescript/bin/tsc
ends up getting marked executable. We, however, choose typescript 3.2, and so we end up makingnode_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.