Repository navigation
[Bug] Resolver supported by Yarn v1 does not work in Yarn v2 #1621
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersreproducibleThis issue can be successfully reproducedThis issue can be successfully reproduced
Description
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.72sReproduction
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
Reacted by Miko, DRiiFT KiinG, Bahaa Fadhil, Matthias and Akash Jani
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomersreproducibleThis issue can be successfully reproducedThis issue can be successfully reproduced
Activity
yarnbot commentedon Jul 24, 2020
yarnbot commentedon Jul 24, 2020
yarnbot commentedon Jul 24, 2020
This issue reproduces on master:
mariusmarais commentedon Jul 24, 2020
Specific package causing problem: https://www.npmjs.com/package/@chakra-ui/styled-system/v/1.0.0-next.6
Specific format causing problem:
npm:@peduarte/styled-system__coreUpdated repro:
arcanis commentedon Jul 24, 2020
Yeah, it's missing a range. Should be
npm:@peduarte/styled-system__core@*or similar. We should relax the descriptor parsing.mariusmarais commentedon Jul 24, 2020
Thanks, adding a resolution with
@*appended works around the issue.Amareis commentedon Aug 5, 2020
yarn add react@npm:@pika/reactis failing too in 2.1.1.And
yarn add react@npm:@pika/react@*failing too:mariusmarais commentedon Aug 5, 2020
@Amareis I'm unsure of a command line option that works, but I was able to workaround by:
package.json:yarn addwithout the version specified.Amareis commentedon Aug 5, 2020
Yep, that works!
mariusmarais commentedon Aug 5, 2020
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.Amareis commentedon Aug 5, 2020
Oh, that's really stupid XD Thanks for tip!
vinaygunnam commentedon Nov 2, 2020
Can someone suggest a workaround to accommodate custom npm tags as shown in the example below?
This results in the following error:
Please note that the package install works as expected with Yarn v1.
For reference,
mariusmarais commentedon Nov 3, 2020
Couldn't find a combination after a couple of tries.
I think it's the
_inlegacy_v1that's causing trouble, sinceyarn add typescript@insidersworks for me.vinaygunnam commentedon Nov 3, 2020
@mariusmarais Indeed, it is the
_.https://github.com/yarnpkg/berry/blob/master/packages/yarnpkg-core/sources/ProtocolResolver.ts#L8
TAG_REGEXP does not account for
_at the moment. Verified the change locally.I'm not sure if there is a spec for npm tags to adhere to besides what is outlined in the note on this page:
https://docs.npmjs.com/adding-dist-tags-to-packages
https://docs.npmjs.com/cli/v6/commands/npm-dist-tag#caveats
Relevant discussion happened here:
#1271 (comment)
Underscore was discussed and later fell out along the way. Looks like it was just a miss.
rtritto commentedon May 16, 2021
Afer I run
yarn add react@npm:@preact/compat@*, I got yarn warnings like this, caused by peerDependency ofnext:Maybe I should add a resolver in .yarnrc or somewhere?
merceyz commentedon May 16, 2021
That warning is valid but you can just ignore it
drew-foxall commentedon Oct 14, 2021
Running yarn workspaces and using 3 aliases
And sadly receiving this error when running yarn install.
mikob commentedon Oct 20, 2021
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.
arcanis commentedon May 23, 2022
Most problems around unrecognized resolvers have been solved in later versions, so I'll close this thread. Please open a new one with a new repro if you still hit it!
Bahaa-Fadhil commentedon Jul 1, 2022
I am trying to install a package, it is: @siedlerchr/types-ol-ext
yarn add -D @types/ol-ext@npm:@siedlerchr/types-ol-extbut I get an error message, see below:
I tried the solution to (#1621 (comment)) put it in package.json as the following but still same problem
have some suggestions on how to fix this
Bahaa-Fadhil commentedon Jul 4, 2022
oky, solution for this problem is:
yarn add -D @types/ol-ext@npm:@siedlerchr/types-ol-ext@^2.1.0or
yarn add -D @types/ol-ext@npm:@siedlerchr/types-ol-ext@latestgugiserman commentedon Aug 11, 2022
worked for me in macOS zsh:
yarn add a@npm:@a/b@\*notice the escape there for the
\*bt-nia commentedon Sep 12, 2023
Why was this bug closed? This is still an issue today and not fixed.
#5724
ayitinya commentedon Oct 31, 2023
I am having a similar problem with yarn 3.
adding the version doesn't change nothing