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

yarn error error Couldn't find any versions for x that matches y #34

Open
milahu opened this issue Nov 1, 2022 · 1 comment
Open

yarn error error Couldn't find any versions for x that matches y #34

milahu opened this issue Nov 1, 2022 · 1 comment

Comments

@milahu
Copy link
Owner

milahu commented Nov 1, 2022

yarn add [email protected]

patch-package jest-snapshot 
error Couldn't find any versions for "jest-snapshot" that matches "26.6.2, jest-snapshot@npm:^26.6.2"

this is in a monorepo (mitosis)
where i install [email protected] in packages/core

grep jest-snapshot package.json 
    "jest-snapshot": "26.6.2",
grep version node_modules/jest-snapshot/package.json 
  "version": "26.6.2",
grep jest-snapshot yarn.lock 
    jest-snapshot: 26.6.2
    jest-snapshot: ^24.9.0
    jest-snapshot: ^26.6.2
    jest-snapshot: ^27.5.1
    jest-snapshot: ^27.5.1
    jest-snapshot: ^24.9.0
    jest-snapshot: ^26.6.2
    jest-snapshot: ^27.5.1
    jest-snapshot: ^24.9.0
    jest-snapshot: ^26.6.2
    jest-snapshot: ^27.5.1
    jest-snapshot: ^24.9.0
    jest-snapshot: ^26.6.2
    jest-snapshot: ^27.5.1
"jest-snapshot@npm:26.6.2, jest-snapshot@npm:^26.6.2":
  resolution: "jest-snapshot@npm:26.6.2"
"jest-snapshot@npm:^24.9.0":
  resolution: "jest-snapshot@npm:24.9.0"
"jest-snapshot@npm:^27.0.2, jest-snapshot@npm:^27.5.1":
  resolution: "jest-snapshot@npm:27.5.1"
    jest-snapshot: ^27.0.2
yarn --version 
3.2.0

upstream says i should use yarn patch but i dont like it

yarn 2+ have native support for patching dependencies via yarn patch. You do not need to use patch-package on these projects.

yarn/lib/cli.js

  couldntFindVersionThatMatchesRange: "Couldn't find any versions for $0 that matches $1",
      var satisfied = yield config.resolveConstraints((0, (_keys || _load_keys()).default)(body.versions), range);
      if (satisfied) {
        return body.versions[satisfied];
      } else if (request && !config.nonInteractive) {
        // ...
      }
      throw new (_errors || _load_errors()).MessageError(config.reporter.lang('couldntFindVersionThatMatchesRange', body.name, range));

the output from child_process is binary (Uint8Array)
cos we dont set { encoding: "utf8" }
ds300#432

patch-package jest-snapshot 
patch-package 6.5.0
• Creating temporary folder
• Installing [email protected] with yarn
warning package.json: No license field
warning No license field
error Couldn't find any versions for "jest-snapshot" that matches "26.6.2, jest-snapshot@npm:^26.6.2"

{
  status: 1,
  signal: null,
  output: [
    null,
    <Buffer 79 61 72 6e 20 69 6e 73 74 61 6c 6c 20 76 31 2e 32 32 2e 31 39 0a 69 6e 66 6f 20 4e 6f 20 6c 6f 63 6b 66 69 6c 65 20 66 6f 75 6e 64 2e 0a 5b 31 2f 34 ... 113 more bytes>,
    <Buffer 77 61 72 6e 69 6e 67 20 70 61 63 6b 61 67 65 2e 6a 73 6f 6e 3a 20 4e 6f 20 6c 69 63 65 6e 73 65 20 66 69 65 6c 64 0a 77 61 72 6e 69 6e 67 20 4e 6f 20 ... 116 more bytes>
  ],
  pid: 2418758,
  stdout: <Buffer 79 61 72 6e 20 69 6e 73 74 61 6c 6c 20 76 31 2e 32 32 2e 31 39 0a 69 6e 66 6f 20 4e 6f 20 6c 6f 63 6b 66 69 6c 65 20 66 6f 75 6e 64 2e 0a 5b 31 2f 34 ... 113 more bytes>,
  stderr: <Buffer 77 61 72 6e 69 6e 67 20 70 61 63 6b 61 67 65 2e 6a 73 6f 6e 3a 20 4e 6f 20 6c 69 63 65 6e 73 65 20 66 69 65 6c 64 0a 77 61 72 6e 69 6e 67 20 4e 6f 20 ... 116 more bytes>,
  error: null
}

/home/user/.local/share/pnpm/global/5/.pnpm/[email protected]/node_modules/patch-package/dist/makePatch.js:218
        throw e;
        ^
{
  status: 1,
  signal: null,
  output: [
    null,
    Buffer(163) [Uint8Array] [
      121,  97, 114, 110,  32, 105, 110, 115, 116,  97, 108, 108,
       32, 118,  49,  46,  50,  50,  46,  49,  57,  10, 105, 110,
      102, 111,  32,  78, 111,  32, 108, 111,  99, 107, 102, 105,
      108, 101,  32, 102, 111, 117, 110, 100,  46,  10,  91,  49,
       47,  52,  93,  32,  82, 101, 115, 111, 108, 118, 105, 110,
      103,  32, 112,  97,  99, 107,  97, 103, 101, 115,  46,  46,
       46,  10, 105, 110, 102, 111,  32,  86, 105, 115, 105, 116,
       32, 104, 116, 116, 112, 115,  58,  47,  47, 121,  97, 114,
      110, 112, 107, 103,
      ... 63 more items
    ],
    Buffer(166) [Uint8Array] [
      119,  97, 114, 110, 105, 110, 103,  32, 112,  97,  99, 107,
       97, 103, 101,  46, 106, 115, 111, 110,  58,  32,  78, 111,
       32, 108, 105,  99, 101, 110, 115, 101,  32, 102, 105, 101,
      108, 100,  10, 119,  97, 114, 110, 105, 110, 103,  32,  78,
      111,  32, 108, 105,  99, 101, 110, 115, 101,  32, 102, 105,
      101, 108, 100,  10, 101, 114, 114, 111, 114,  32,  67, 111,
      117, 108, 100, 110,  39, 116,  32, 102, 105, 110, 100,  32,
       97, 110, 121,  32, 118, 101, 114, 115, 105, 111, 110, 115,
       32, 102, 111, 114,
      ... 66 more items
    ]
  ],
  pid: 2418758,
  stdout: Buffer(163) [Uint8Array] [
    121,  97, 114, 110,  32, 105, 110, 115, 116,  97, 108, 108,
     32, 118,  49,  46,  50,  50,  46,  49,  57,  10, 105, 110,
    102, 111,  32,  78, 111,  32, 108, 111,  99, 107, 102, 105,
    108, 101,  32, 102, 111, 117, 110, 100,  46,  10,  91,  49,
     47,  52,  93,  32,  82, 101, 115, 111, 108, 118, 105, 110,
    103,  32, 112,  97,  99, 107,  97, 103, 101, 115,  46,  46,
     46,  10, 105, 110, 102, 111,  32,  86, 105, 115, 105, 116,
     32, 104, 116, 116, 112, 115,  58,  47,  47, 121,  97, 114,
    110, 112, 107, 103,
    ... 63 more items
  ],
  stderr: Buffer(166) [Uint8Array] [
    119,  97, 114, 110, 105, 110, 103,  32, 112,  97,  99, 107,
     97, 103, 101,  46, 106, 115, 111, 110,  58,  32,  78, 111,
     32, 108, 105,  99, 101, 110, 115, 101,  32, 102, 105, 101,
    108, 100,  10, 119,  97, 114, 110, 105, 110, 103,  32,  78,
    111,  32, 108, 105,  99, 101, 110, 115, 101,  32, 102, 105,
    101, 108, 100,  10, 101, 114, 114, 111, 114,  32,  67, 111,
    117, 108, 100, 110,  39, 116,  32, 102, 105, 110, 100,  32,
     97, 110, 121,  32, 118, 101, 114, 115, 105, 111, 110, 115,
     32, 102, 111, 114,
    ... 66 more items
  ],
  error: null
}

Node.js v18.9.1
@milahu
Copy link
Owner Author

milahu commented Nov 1, 2022

wrong version in the generated package.json

// cat /tmp/tmp-2420557eUXwBe3MRlur/package.json | jq
{
  "dependencies": {
    "jest-snapshot": "26.6.2, jest-snapshot@npm:^26.6.2"
  },
  "resolutions": {}
}
# grep -A23 "26.6.2, jest-snapshot@npm:^26.6.2" yarn.lock 
"jest-snapshot@npm:26.6.2, jest-snapshot@npm:^26.6.2":
  version: 26.6.2
  resolution: "jest-snapshot@npm:26.6.2"
  dependencies:
    "@babel/types": ^7.0.0
    "@jest/types": ^26.6.2
    "@types/babel__traverse": ^7.0.4
    "@types/prettier": ^2.0.0
    chalk: ^4.0.0
    expect: ^26.6.2
    graceful-fs: ^4.2.4
    jest-diff: ^26.6.2
    jest-get-type: ^26.3.0
    jest-haste-map: ^26.6.2
    jest-matcher-utils: ^26.6.2
    jest-message-util: ^26.6.2
    jest-resolve: ^26.6.2
    natural-compare: ^1.4.0
    pretty-format: ^26.6.2
    semver: ^7.3.2
  checksum: 53f1de055b1d3840bc6e851fd674d5991b844d4695dadbd07354c93bf191048d8767b8606999847e97c4214a485b9afb45c1d2411772befa1870414ac973b3e2
  languageName: node
  linkType: hard

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

No branches or pull requests

1 participant