You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: correction to the set resolution docs (#6739)
## What's the problem this PR addresses?
The example in the `set resolution` docs does not work for many
packages.
https://yarnpkg.com/cli/set/resolution#examples
### Issues
Resolves#5979
### Steps to reproduce:
1. Clone and `cd` to the `yarnpkg/berry` repository
2. Run `yarn set resolution lodash@npm:^4.17.11 4.16.0`
3. Observe the following error
```
yarn set resolution lodash@npm:^4.17.11 4.16.0
➤ YN0000: · Yarn 4.7.0-dev
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: [email protected] isn't supported by any available resolver
at MultiResolver.getResolverByDescriptor (/Users/***/personal/berry/packages/yarnpkg-core/sources/MultiResolver.ts:73:13)
at MultiResolver.getResolutionDependencies (/Users/***/personal/berry/packages/yarnpkg-core/sources/MultiResolver.ts:37:27)
at startDescriptorResolution (/Users/***/personal/berry/packages/yarnpkg-core/sources/Project.ts:911:53)
at <anonymous> (/Users/***/personal/berry/packages/yarnpkg-core/sources/Project.ts:955:57)
at async startDescriptorAliasing (/Users/***/personal/berry/packages/yarnpkg-core/sources/Project.ts:896:28)
➤ YN0000: └ Completed
➤ YN0000: · Failed with errors in 0s 154ms
```
## How did you fix it?
The fix is to include npm before the resolved version, `4.16.0` ->
`npm:4.16.0`.
The full command will be `yarn set resolution lodash@npm:^4.17.11
npm:4.16.0`.
### Result
Yarn correctly set the resolution in the yarn.lock file as follows:
```
"lodash@npm:^4.17.11":
version: 4.16.0
resolution: "lodash@npm:4.16.0"
checksum: 10/37d70b8a67edd4f3ef82ba3354de8dc4123ee9eddd84700a69edd3e2e3f8ae8d562162ed5af95d60810c333745c6ded9c8f432d19840387cde071ddcef5c6ec7
languageName: node
linkType: hard
```
## Checklist
<!--- Don't worry if you miss something, chores are automatically
tested. -->
<!--- This checklist exists to help you remember doing the chores when
you submit a PR. -->
<!--- Put an `x` in all the boxes that apply. -->
- [x] I have read the [Contributing
Guide](https://yarnpkg.com/advanced/contributing).
<!-- See
https://yarnpkg.com/advanced/contributing#preparing-your-pr-to-be-released
for more details. -->
<!-- Check with `yarn version check` and fix with `yarn version check
-i` -->
- [x] I have set the packages that need to be released for my changes to
be effective.
<!-- The "Testing chores" workflow validates that your PR follows our
guidelines. -->
<!-- If it doesn't pass, click on it to see details as to what your PR
might be missing. -->
- [x] I will check that all automated PR checks pass before the PR gets
reviewed.
---------
Co-authored-by: Clement Yan <[email protected]>
0 commit comments