Skip to content

Add support for yarn-path property  #347

Open
@markjm

Description

@markjm

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!

Activity

linked a pull request that will close this issue on Sep 13, 2021
lencioni

lencioni commented on Oct 26, 2021

@lencioni

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

NMinhNguyen commented on Nov 18, 2021

@NMinhNguyen
Contributor

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Add support for yarn-path property · Issue #347 · ds300/patch-package