berry
berry copied to clipboard
[Bug?]: Attempting to add package with specific dist tag pattern(s) throws resolver error
Self-service
- [ ] I'd be willing to implement a fix
Describe the bug
Recently it has come to my attention that if a package's dist-tag has a specific format, I.e. the regex format of /v\d{2}-[a-z]{1,}/ that yarn throws an error:
❯ yarn add discord.js@v13-lts
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: discord.js@v13-lts isn't supported by any available resolver
at Bd.getResolverByDescriptor (/Users/favna/workspace/temp/.yarn/releases/yarn-3.2.3.cjs:391:1664)
at Bd.bindDescriptor (/Users/favna/workspace/temp/.yarn/releases/yarn-3.2.3.cjs:391:1053)
at ee (/Users/favna/workspace/temp/.yarn/releases/yarn-3.2.3.cjs:439:6954)
at async Promise.allSettled (index 0)
at async ho (/Users/favna/workspace/temp/.yarn/releases/yarn-3.2.3.cjs:390:10446)
at async /Users/favna/workspace/temp/.yarn/releases/yarn-3.2.3.cjs:439:8292
at async Je.startProgressPromise (/Users/favna/workspace/temp/.yarn/releases/yarn-3.2.3.cjs:390:48066)
at async ze.resolveEverything (/Users/favna/workspace/temp/.yarn/releases/yarn-3.2.3.cjs:439:6285)
at async /Users/favna/workspace/temp/.yarn/releases/yarn-3.2.3.cjs:442:2132
at async Je.startSectionPromise (/Users/favna/workspace/temp/.yarn/releases/yarn-3.2.3.cjs:409:3303)
➤ YN0000: └ Completed
➤ YN0000: Failed with errors in 0s 17ms
Likewise the format of /v\d{2}/ also doesn't work:
❯ yarn add @favware/skip-dependency@v13
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: @favware/skip-dependency@npm:v13: No candidates found
at ce (/Users/favna/workspace/temp/.yarn/releases/yarn-3.2.3.cjs:439:7864)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.allSettled (index 0)
at async ho (/Users/favna/workspace/temp/.yarn/releases/yarn-3.2.3.cjs:390:10446)
➤ YN0000: └ Completed in 2s 593ms
➤ YN0000: Failed with errors in 2s 595ms
Both of these dist-tags install just fine with Yarn v1, NPM and PNPM.
To reproduce
const installPromise = packageJsonAndInstall({
dependencies: {
[`discord.js`]: `v13-lts`,
},
});
await expect(installPromise)
.resolves.toBeTruthy();
Environment
System:
OS: macOS 12.5.1
CPU: (8) arm64 Apple M1
Binaries:
Node: 18.8.0 - /private/var/folders/jy/w45_1th97698mzgm_nsfl35w0000gn/T/xfs-de02679f/node
Yarn: 3.2.3 - /private/var/folders/jy/w45_1th97698mzgm_nsfl35w0000gn/T/xfs-de02679f/yarn
npm: 8.18.0 - ~/.volta/tools/image/node/18.8.0/bin/npm
Additional context
Besides the Sherlock reproduction the barest minimal way to reproduce the issue is by running:
yarn set version 3.2.3 && yarn add discord.js@v13-lts
This issue reproduces on master:
Error: expect(received).resolves.toBeTruthy()
Received promise rejected instead of resolved
Rejected to value: [Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js install
➤ YN0000: ┌ Resolution step
::group::Resolution step
➤ YN0001: │ Error: discord.js@v13-lts isn't supported by any available resolver
at MultiResolver.getResolverByDescriptor (/github/workspace/packages/yarnpkg-core/sources/MultiResolver.ts:73:13)
at MultiResolver.bindDescriptor (/github/workspace/packages/yarnpkg-core/sources/MultiResolver.ts:31:27)
at Project.preparePackage (/github/workspace/packages/yarnpkg-core/sources/Project.ts:674:30)
at startPackageResolution (/github/workspace/packages/yarnpkg-core/sources/Project.ts:760:21)
::endgroup::
➤ YN0000: └ Completed
➤ YN0000: Failed with errors in 0s 96ms
]
at expect (/github/workspace/.yarn/cache/expect-npm-24.8.0-8c7640c562-44ff9ab1e7.zip/node_modules/expect/build/index.js:138:15)
at module.exports (evalmachine.<anonymous>:8:7)
at /github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:57:19
at executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:18:22)
at executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:25:18)
at ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-2.0.3-558f52b79f-286d94b96d.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:26:76)
at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-4061026d74.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-4061026d74.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-4061026d74.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)