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(checkYarn): Use realpath to detect corepack #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Tobbe
Copy link
Member

@Tobbe Tobbe commented Feb 10, 2024

rw exits with a non-descript error when checking the yarn installation
image

Even the debug log is pretty unhelpful
image
Just says command failed with error and exit status 1.
No clues as to what actually caused it to fail

With this PR you'd get a more helpful log message:
image
No project found in /Users/tobbe/dev/redwood/rw-cli
yarn exec <commandName> ...

And to get around the actual error I implemented a call to realpath $(which yarn). If that check passes I skip yarn exec env. If the realpath check fails the code still falls back to yarn exec env.

The usage of yarn exec env comes from here https://yarnpkg.com/corepack#installation
But it apparently only works if you're already in an initialized yarn project.

The "official" recommended real solution to this seems to be to enable corepack in a temp directory and use that.
nodejs/corepack#113

But before going down that route I just did the realpath check for now as that was much easier and faster to implement.

I also asked on the yarn discord about this. See if they come back with any other ideas before we implement anything too crazy here. https://discord.com/channels/226791405589233664/654372321225605128/1205773363981848586

@Tobbe Tobbe changed the title fix(yarn-check): Use realpath to detect corepack fix(checkYarn): Use realpath to detect corepack Feb 10, 2024
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.

1 participant