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

Add support for yarn-path property #347

Open
markjm opened this issue Sep 13, 2021 · 2 comments · May be fixed by #348
Open

Add support for yarn-path property #347

markjm opened this issue Sep 13, 2021 · 2 comments · May be fixed by #348

Comments

@markjm
Copy link

markjm commented Sep 13, 2021

Yarn supports a yarn-path option, which allows you to point to a version of yarn within the repo. This makes it easy to ensure everyone working in the repo to be on the same version.

If this setting is specified, when patch-package copies over the .yarnrc to the temp folder, yarn will fail because it doesnt also copy over the yarn version. I think instead of copying the yarnrc, we can instead read, modify, and write the file to point to the correct old path. I will link the PR with this approach below. Let me know what you think!

@markjm markjm linked a pull request Sep 13, 2021 that will close this issue
@lencioni
Copy link

Supporting yarn-path would be great! Today, this will fail for me like:

nternal/modules/cjs/loader.js:983
  throw err;
  ^

Error: Cannot find module '/private/var/folders/xx/x1wk74qd7pl6zh7y_0x3lqs00000gn/T/tmp-37785Pjy7IcDusgFR/script/my-yarn.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

{
  status: 1,
  signal: null,
  output: [
    null,
    <Buffer >,
    <Buffer 69 6e 74 65 72 6e 61 6c 2f 6d 6f 64 75 6c 65 73 2f 63 6a 73 2f 6c 6f 61 64 65 72 2e 6a 73 3a 39 38 33 0a 20 20 74 68 72 6f 77 20 65 72 72 3b 0a 20 20 ... 469 more bytes>
  ],
  pid: 37788,
  stdout: <Buffer >,
  stderr: <Buffer 69 6e 74 65 72 6e 61 6c 2f 6d 6f 64 75 6c 65 73 2f 63 6a 73 2f 6c 6f 61 64 65 72 2e 6a 73 3a 39 38 33 0a 20 20 74 68 72 6f 77 20 65 72 72 3b 0a 20 20 ... 469 more bytes>,
  error: null
}

@NMinhNguyen
Copy link
Contributor

NMinhNguyen commented Nov 18, 2021

This is actually my bad - I introduced the copying of .yarnrc in #222 (matching the existing logic of copying .npmrc) as I needed Yarn to point at the correct npm registry, but I also ran into this yarn-path issue and forgot to file it. A simple workaround is to comment out yarn-path before you run patch-package, but your PR makes sense. Thanks for fixing 🙂

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 a pull request may close this issue.

3 participants