Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

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

Closed

Description

@mariusmarais

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

Activity

  1. yarnbot commented on Jul 24, 2020

    @yarnbot
  2. added
    reproducibleThis issue can be successfully reproduced
    and removed
    broken-reproThe reproduction in this issue is broken
    on Jul 24, 2020
  3. yarnbot commented on Jul 24, 2020

    @yarnbot
  4. yarnbot commented on Jul 24, 2020

    @yarnbot
    Collaborator

    This issue reproduces on master:

    Error: expect(received).resolves.toBeTruthy()
    
    Received promise rejected instead of resolved
    Rejected to value: [Error: Command failed: /usr/bin/node /github/workspace/scripts/actions/../run-yarn.js install
    
    ➤ YN0000: ┌ Resolution step
    ::group::Resolution step
    ➤ YN0001: │ Error: @types/styled-system__core@npm:@peduarte/styled-system__core isn't supported by any available resolver
        at MultiResolver.getResolverByDescriptor (/github/workspace/packages/yarnpkg-core/sources/MultiResolver.ts:67:13)
        at MultiResolver.bindDescriptor (/github/workspace/packages/yarnpkg-core/sources/MultiResolver.ts:31:27)
        at /github/workspace/packages/yarnpkg-core/sources/Project.ts:795:34
        at runMicrotasks (<anonymous>)
        at processTicksAndRejections (internal/process/task_queues.js:97:5)
        at async Promise.all (index 15)
        at Project.resolveEverything (/github/workspace/packages/yarnpkg-core/sources/Project.ts:772:35)
        at /github/workspace/packages/yarnpkg-core/sources/Project.ts:1464:7
        at StreamReport.startTimerPromise (/github/workspace/packages/yarnpkg-core/sources/StreamReport.ts:248:14)
        at Project.install (/github/workspace/packages/yarnpkg-core/sources/Project.ts:1447:5)
    ::endgroup::
    ➤ YN0000: └ Completed in 1.27s
    ➤ YN0000: Failed with errors in 1.27s
    ]
        at expect (/github/workspace/.yarn/cache/expect-npm-24.8.0-8c7640c562-0ac41999f0.zip/node_modules/expect/build/index.js:138:15)
        at module.exports (evalmachine.<anonymous>:8:7)
        at /github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:56:19
        at executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:17:22)
        at Object.executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:24:18)
        at ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:25:59)
        at async ExecCommand.validateAndExecute (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Command.js:161:26)
        at async Cli.run (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Cli.js:74:24)
        at async Cli.runExit (/github/workspace/.yarn/cache/clipanion-npm-2.0.0-rc.16-b9444aaf89-a57989414f.zip/node_modules/clipanion/lib/advanced/Cli.js:83:28)
    
  5. mariusmarais commented on Jul 24, 2020

    @mariusmarais
    Author

    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__core

    Updated repro:

    await expect(packageJsonAndInstall({
      dependencies: {
        ["@types/styled-system__core"]: "npm:@peduarte/styled-system__core",
      }
    })).resolves.toBeTruthy();
  6. arcanis commented on Jul 24, 2020

    @arcanis
    Member

    Yeah, it's missing a range. Should be npm:@peduarte/styled-system__core@* or similar. We should relax the descriptor parsing.

  7. mariusmarais commented on Jul 24, 2020

    @mariusmarais
    Author

    Thanks, adding a resolution with @* appended works around the issue.

  8. Amareis commented on Aug 5, 2020

    @Amareis

    yarn add react@npm:@pika/react is failing too in 2.1.1.

     YN0000: ┌ Resolution step
    ➤ YN0001: │ Error: react@npm:@pika/react isn't supported by any available resolver
        at i.getResolverByDescriptor (/home/joe/work/ppldo-front/.yarn/releases/yarn-2.1.1.cjs:2:266590)
        at i.bindDescriptor (/home/joe/work/ppldo-front/.yarn/releases/yarn-2.1.1.cjs:2:266044)
        at Promise.all.s.map (/home/joe/work/ppldo-front/.yarn/releases/yarn-2.1.1.cjs:2:288133)
    ➤ YN0000: └ Completed
    ➤ YN0000: Failed with errors in 0.14s
    

    And yarn add react@npm:@pika/react@* failing too:

     YN0000: ┌ Resolution step
    ➤ YN0001: │ Error: Assertion failed: The package could not be found
        at C (/home/joe/work/ppldo-front/.yarn/releases/yarn-2.1.1.cjs:2:290431)
        at I.w.push (/home/joe/work/ppldo-front/.yarn/releases/yarn-2.1.1.cjs:2:292848)
        at I (/home/joe/work/ppldo-front/.yarn/releases/yarn-2.1.1.cjs:2:293562)
        at E (/home/joe/work/ppldo-front/.yarn/releases/yarn-2.1.1.cjs:2:290551)
        at I.B.push (/home/joe/work/ppldo-front/.yarn/releases/yarn-2.1.1.cjs:2:293419)
        at I (/home/joe/work/ppldo-front/.yarn/releases/yarn-2.1.1.cjs:2:294303)
        at E (/home/joe/work/ppldo-front/.yarn/releases/yarn-2.1.1.cjs:2:290551)
        at project (/home/joe/work/ppldo-front/.yarn/releases/yarn-2.1.1.cjs:2:294382)
        at ne.resolveEverything (/home/joe/work/ppldo-front/.yarn/releases/yarn-2.1.1.cjs:2:294409)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ➤ YN0000: └ Completed in 3.64s
    ➤ YN0000: Failed with errors in 3.65s
    
    
  9. mariusmarais commented on Aug 5, 2020

    @mariusmarais
    Author

    @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.
  10. Amareis commented on Aug 5, 2020

    @Amareis

    Yep, that works!

  11. mariusmarais commented on Aug 5, 2020

    @mariusmarais
    Author

    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.

  12. Amareis commented on Aug 5, 2020

    @Amareis

    Oh, that's really stupid XD Thanks for tip!

  13. vinaygunnam commented on Nov 2, 2020

    @vinaygunnam
    Contributor

    Can someone suggest a workaround to accommodate custom npm tags as shown in the example below?

    mkdir dummy-repo
    cd dummy-repo
    yarn init
    yarn set version berry
    yarn add yarn-custom-tag-poc-dep@legacy_v1

    This results in the following error:

    ❯ yarn add yarn-custom-tag-poc-dep@legacy_v1
    ➤ YN0000: ┌ Resolution step
    ➤ YN0001: │ Error: yarn-custom-tag-poc-dep@legacy_v1 isn't supported by any available resolver
        at i.getResolverByDescriptor (/Uxyz/me/trash/yarn-resolver/.yarn/releases/yarn-berry.cjs:2:314629)
        at i.bindDescriptor (/Uxyz/me/trash/yarn-resolver/.yarn/releases/yarn-berry.cjs:2:313994)
        at /Uxyz/me/trash/yarn-resolver/.yarn/releases/yarn-berry.cjs:2:337305
        at async Promise.all (index 0)
        at async Ae.resolveEverything (/Uxyz/me/trash/yarn-resolver/.yarn/releases/yarn-berry.cjs:2:336628)
        at async /Uxyz/me/trash/yarn-resolver/.yarn/releases/yarn-berry.cjs:2:353796
        at async C.startTimerPromise (/Uxyz/me/trash/yarn-resolver/.yarn/releases/yarn-berry.cjs:2:364724)
        at async Ae.install (/Uxyz/me/trash/yarn-resolver/.yarn/releases/yarn-berry.cjs:2:353430)
        at async /Uxyz/me/trash/yarn-resolver/.yarn/releases/yarn-berry.cjs:2:28804
        at async Function.start (/Uxyz/me/trash/yarn-resolver/.yarn/releases/yarn-berry.cjs:2:363855)
    ➤ YN0000: └ Completed
    ➤ YN0000: Failed with errors in 0s 8ms
    

    Please note that the package install works as expected with Yarn v1.

    For reference,

    ❯ yarn -v
    1.22.10
  14. mariusmarais commented on Nov 3, 2020

    @mariusmarais
    Author

    Couldn't find a combination after a couple of tries.

    I think it's the _ in legacy_v1 that's causing trouble, since yarn add typescript@insiders works for me.

  15. vinaygunnam commented on Nov 3, 2020

    @vinaygunnam
    Contributor

    @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.

  16. rtritto commented on May 16, 2021

    @rtritto

    Afer I run yarn add react@npm:@preact/compat@*, I got yarn warnings like this, caused by peerDependency of next:

    ...
    ➤ YN0060: │ my-project@workspace:. provides react (p5a6eb) with version 0.0.4, which doesn't satisfy what next and some 
    of its descendants request
    ...
    

    Maybe I should add a resolver in .yarnrc or somewhere?

  17. merceyz commented on May 16, 2021

    @merceyz
    Member

    That warning is valid but you can just ignore it

  18. drew-foxall commented on Oct 14, 2021

    @drew-foxall

    Running yarn workspaces and using 3 aliases

        "react": "npm:@preact/compat@*",
        "react-dom": "npm:@preact/compat@*",
        "react-ssr-prepass": "npm:preact-ssr-prepass@*",
    

    And sadly receiving this error when running yarn install.

    YN0000: ┌ Resolution step
    ➤ YN0061: │ querystring@npm:0.2.1 is deprecated: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
    ➤ YN0061: │ querystring@npm:0.2.0 is deprecated: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
    ➤ YN0032: │ evp_bytestokey@npm:1.0.3: Implicit dependencies on node-gyp are discouraged
    ➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
    ➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
    ➤ YN0001: │ Error: Assertion failed: The package could not be found
    
  19. mikob commented on Oct 20, 2021

    @mikob

    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.

  20. arcanis commented on May 23, 2022

    @arcanis
    Member

    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!

  21. Bahaa-Fadhil commented on Jul 1, 2022

    @Bahaa-Fadhil

    I am trying to install a package, it is: @siedlerchr/types-ol-ext

    yarn add -D @types/ol-ext@npm:@siedlerchr/types-ol-ext

    but I get an error message, see below:

    $ yarn add -D @types/ol-ext@npm:@siedlerchr/types-ol-ext
    ➤ YN0000: ┌ Resolution step
    ➤ YN0001: │ Error: @types/ol-ext@@npm:@siedlerchr/types-ol-ext isn't supported by any available resolver
        at Xc.getResolverByDescriptor (.....\yarn-3.0.2.cjs:294:5330)
    
    ➤ YN0000: └ Completed
    ➤ YN0000: Failed with errors in 0s 95ms
    

    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

  22. Bahaa-Fadhil commented on Jul 4, 2022

    @Bahaa-Fadhil

    I am trying to install a package, it is: @siedlerchr/types-ol-ext

    yarn add -D @types/ol-ext@npm:@siedlerchr/types-ol-ext

    but I get an error message, see below:

    $ yarn add -D @types/ol-ext@npm:@siedlerchr/types-ol-ext
    ➤ YN0000: ┌ Resolution step
    ➤ YN0001: │ Error: @types/ol-ext@@npm:@siedlerchr/types-ol-ext isn't supported by any available resolver
        at Xc.getResolverByDescriptor (.....\yarn-3.0.2.cjs:294:5330)
    
    ➤ YN0000: └ Completed
    ➤ YN0000: Failed with errors in 0s 95ms
    

    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

    oky, solution for this problem is:
    yarn add -D @types/ol-ext@npm:@siedlerchr/types-ol-ext@^2.1.0
    or
    yarn add -D @types/ol-ext@npm:@siedlerchr/types-ol-ext@latest

  23. gugiserman commented on Aug 11, 2022

    @gugiserman

    worked for me in macOS zsh:

    yarn add a@npm:@a/b@\*

    notice the escape there for the \*

  24. bt-nia commented on Sep 12, 2023

    @bt-nia

    Why was this bug closed? This is still an issue today and not fixed.
    #5724

  25. ayitinya commented on Oct 31, 2023

    @ayitinya

    I am having a similar problem with yarn 3.
    adding the version doesn't change nothing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomersreproducibleThis issue can be successfully reproduced

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions