berry: [Bug] Resolver supported by Yarn v1 does not work in Yarn v2
Describe the bug
A resolver supported by Yarn 1 is not supported by Yarn 2. I cannot personally parse the error well enough to understand what exactly isn’t supported.
To Reproduce
Yarn 1 works:
mkdir y1
cd y1
yarn init
yarn add @chakra-ui/core@1.0.0-next.6
# works \o/
Yarn 2 does not:
/tmp ❯❯❯ mkdir y2
/tmp ❯❯❯ cd y2
/t/y2 ❯❯❯ yarn init -2
yarn init v1.22.4
Resolving berry to a url...
Downloading https://github.com/yarnpkg/berry/raw/master/packages/berry-cli/bin/berry.js...
Saving it into /private/tmp/y2/.yarn/releases/yarn-berry.js...
Updating /private/tmp/y2/.yarnrc.yml...
Done!
{
name: 'y2'
}
✨ Done in 3.87s.
/t/y2 ❯❯❯ yarn --version
2.1.1
/t/y2 ❯❯❯ yarn add @chakra-ui/core@1.0.0-next.6
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: @types/styled-system__core@npm:@peduarte/styled-system__core isn't supported by any available resolver
at i.getResolverByDescriptor (/private/tmp/y2/.yarn/releases/yarn-berry.js:2:266590)
at i.bindDescriptor (/private/tmp/y2/.yarn/releases/yarn-berry.js:2:266044)
at /private/tmp/y2/.yarn/releases/yarn-berry.js:2:288133
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Promise.all (index 18)
at async ne.resolveEverything (/private/tmp/y2/.yarn/releases/yarn-berry.js:2:287456)
at async /private/tmp/y2/.yarn/releases/yarn-berry.js:2:304371
at async f.startTimerPromise (/private/tmp/y2/.yarn/releases/yarn-berry.js:2:313773)
at async ne.install (/private/tmp/y2/.yarn/releases/yarn-berry.js:2:304005)
➤ YN0000: └ Completed in 0.71s
➤ YN0000: Failed with errors in 0.72s
Reproduction
const installPromise = packageJsonAndInstall({
dependencies: {
[`@chakra-ui/core`]: `1.0.0-next.6`
}
});
await expect(installPromise).resolves.toBeTruthy();
Environment if relevant (please complete the following information):
- OS: OSX 10.15.5
- Node version 12.18.2
- Yarn version 2.1.1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 24 (5 by maintainers)
Why was this bug closed? This is still an issue today and not fixed. https://github.com/yarnpkg/berry/issues/5724
That warning is valid but you can just ignore it
@Amareis I’m unsure of a command line option that works, but I was able to workaround by:
package.json
:yarn add
without the version specified.I am having a similar problem with yarn 3. adding the version doesn’t change nothing
oky, solution for this problem is:
yarn add -D @types/ol-ext@npm:@siedlerchr/types-ol-ext@^2.1.0
oryarn add -D @types/ol-ext@npm:@siedlerchr/types-ol-ext@latest
This will likely hit a lot of ppl with the release of typescript v4.5, which recommends using lib replacement for a common scenario: https://www.npmjs.com/package/@types/web
The workaround worked for me, but took a while to find this thread.
BTW,
yarn add "react@npm:@pika/react@*"
works for me. Your shell probably expanded the*
into whatever files are in your current directory, which then can’t be found as packages.yarn add react@npm:@pika/react
is failing too in 2.1.1.And
yarn add react@npm:@pika/react@*
failing too:Yeah, it’s missing a range. Should be
npm:@peduarte/styled-system__core@*
or similar. We should relax the descriptor parsing.This issue reproduces on master: