fix: crashes when yarn 2 and above is used with the --ignore-engines flag#608
Open
foxnewsnetwork wants to merge 1 commit intods300:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Background
If you've ever run
sometimes you'll notice you get these errors
by adding a utf-8 encoding command at
patch-package/src/makePatch.ts
Lines 211 to 214 in be4dfd7
and logging out the results, we see that the error is actually
Root Cause
It seems this happens because
--ignore-enginesis killed, but sometimes projects use yarn v2 and above (always a mistake, but it can't be helped) and so yarn just crashes (thanks Yehuda)What can we do about it
In an independent effort in #506 , there is effort (dated to 2023 though) to get yarn v2 and above working (that is, so that we can drop the
--ignore-engines)However, because yarn v2 and above already supports their own variant of patching via yarn patch, it seems unlikely there will much demand to actually drive #506 through to completion
Anyway, in the meantime, the easiest thing to do is just to force yarn to be on v1
Code Changes
packageManagerdirectiveencoding: 'utf-8'in some spawn commands (to generate more helpful errors)