berry icon indicating copy to clipboard operation
berry copied to clipboard

[Bug?]: The command for set resolution has changed in v4

Open dbasilio opened this issue 1 year ago • 1 comments

Self-service

  • [ ] I'd be willing to implement a fix

Describe the bug

The command yarn set resolution requires you to specify a resolver for the resulting version. Either there's a new issue in v4 or the docs are out of date as the example from the docs is still yarn set resolution lodash@npm:^1.2.3 1.5.0 but this fails.

To reproduce

yarn set resolution "@types/react@npm:*" 16.14.35 produces

➤ YN0000: · Yarn 4.0.2
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: @types/[email protected] isn't supported by any available resolver
    at vd.getResolverByDescriptor (/Users/username/.cache/node/corepack/yarn/4.0.2/yarn.js:141:1698)
    at vd.getResolutionDependencies (/Users/username/.cache/node/corepack/yarn/4.0.2/yarn.js:141:1177)
    at ke (/Users/username/.cache/node/corepack/yarn/4.0.2/yarn.js:210:8191)
    at /Users/username/.cache/node/corepack/yarn/4.0.2/yarn.js:210:8976
    at async Ie (/Users/username/.cache/node/corepack/yarn/4.0.2/yarn.js:210:7929)
➤ YN0000: └ Completed
➤ YN0000: · Failed with errors in 0s 199ms

but yarn set resolution "@types/react@npm:*" npm:16.14.35 works correctly. Also reproducible on packages without an @ symbol.

Environment

System:
    OS: macOS 13.5.2
    CPU: (8) arm64 Apple M1 Pro
  Binaries:
    Node: 18.18.2 - /private/var/folders/wx/4dx7qyqx7js7_p4d5y3gfv0h0000gq/T/xfs-e50421e4/node
    Yarn: 4.0.2 - /private/var/folders/wx/4dx7qyqx7js7_p4d5y3gfv0h0000gq/T/xfs-e50421e4/yarn
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm

Additional context

No response

dbasilio avatar Nov 16 '23 14:11 dbasilio