question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Resolver supported by Yarn v1 does not work in Yarn v2

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:22 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
mariusmaraiscommented, Aug 5, 2020

@Amareis I’m unsure of a command line option that works, but I was able to workaround by:

  1. Adding to package.json:
"resolutions": {
  "@types/styled-system__core": "npm:@peduarte/styled-system__core@*"
}
  1. Then running yarn add without the version specified.
2reactions
mikobcommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Codes | Yarn - Package Manager
This error means that this process failed and Yarn cannot successfully figure out which version of the package should be added to your...
Read more >
Yarn 3.0 - Hacker News
Yarn 1 was compatible with NPM, so switching was easy, but Yarn 2 seems to need explicit support in a lot of cases....
Read more >
Using modern Yarn for deployment with Node.js on Azure App ...
Else, run npm i -g corepack . Next, run yarn init -2 . You should now see 5 files and a directory get...
Read more >
Yarn 2 workspaces not installing dependencies - Stack Overflow
Once you have run 'yarn install', you can start the servers however you did before but prepending 'yarn workspace WORKSPACENAME '.
Read more >
Introducing Yarn 2 ! - DEV Community ‍ ‍
This work couldn't have been possible without the support from many people ... The yarn package on npm will not change; we will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found