Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Resolver does not work with alias without range #1816

Open
ikatyang opened this issue Sep 7, 2020 · 2 comments
Open

[Bug] Resolver does not work with alias without range #1816

ikatyang opened this issue Sep 7, 2020 · 2 comments
Labels
bug Something isn't working reproducible This issue can be successfully reproduced

Comments

@ikatyang
Copy link

ikatyang commented Sep 7, 2020

Describe the bug

Resolver does not work with alias without range, alias should work the same way as normal dependencies, i.e.,

  • yarn add typescript will be resolved as "typescript": "^X.Y.Z", so that
  • yarn add alias@npm:typescript should be resolved as "alias": "npm:typescript@^X.Y.Z"

To Reproduce

  • unscoped:

    await packageJsonAndInstall({});
    await expect(yarn(`add`, `alias@npm:typescript`)).resolves.toBeTruthy();
    // Error: alias@npm:typescript: Registry failed to return tag "typescript"
  • scoped:

    await packageJsonAndInstall({});
    await expect(yarn(`add`, `alias@npm:@babel/core`)).resolves.toBeTruthy();
    // Error: alias@npm:@babel/core isn't supported by any available resolver

Environment

  • Yarn version 2.2.2

Additional context

@ikatyang ikatyang added the bug Something isn't working label Sep 7, 2020
@yarnbot yarnbot added the reproducible This issue can be successfully reproduced label Sep 7, 2020
@yarnbot
Copy link
Collaborator

yarnbot commented Sep 7, 2020

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 add alias@npm:@babel/core

➤ YN0000: ┌ Resolution step
::group::Resolution step
➤ YN0001: │ Error: alias@npm:@babel/core isn't supported by any available resolver
    at MultiResolver.getResolverByDescriptor (/github/workspace/packages/yarnpkg-core/sources/MultiResolver.ts:73:13)
    at MultiResolver.bindDescriptor (/github/workspace/packages/yarnpkg-core/sources/MultiResolver.ts:31:27)
    at /github/workspace/packages/yarnpkg-core/sources/Project.ts:824:34
    at async Promise.all (index 0)
    at Project.resolveEverything (/github/workspace/packages/yarnpkg-core/sources/Project.ts:801:35)
    at /github/workspace/packages/yarnpkg-core/sources/Project.ts:1499:7
    at StreamReport.startTimerPromise (/github/workspace/packages/yarnpkg-core/sources/StreamReport.ts:249:14)
    at Project.install (/github/workspace/packages/yarnpkg-core/sources/Project.ts:1482:5)
    at /github/workspace/packages/plugin-essentials/sources/commands/add.ts:279:7
    at Function.start (/github/workspace/packages/yarnpkg-core/sources/StreamReport.ts:133:7)
::endgroup::
➤ YN0000: └ Completed
➤ YN0000: Failed with errors in 0s 114ms
]
    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>:3:7)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async /github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:56:13
    at async executeInTempDirectory (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:17:16)
    at async Object.executeRepro (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/executeRepro.js:24:12)
    at async ExecCommand.execute (/github/workspace/.yarn/cache/@arcanis-sherlock-npm-1.0.38-d4f5e2dbf3-63f998598d.zip/node_modules/@arcanis/sherlock/lib/commands/exec.js:25:38)
    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)

@sshquack
Copy link

Ran into this same issue while installing TailwindCSS with Yarn 2 tailwindlabs/tailwindcss#3432

$ yarn add tailwindcss@npm:@tailwindcss/postcss7-compat
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: tailwindcss@npm:@tailwindcss/postcss7-compat isn't supported by any available resolver
    at n.getResolverByDescriptor (/Users/someone/a-react-app/.yarn/releases/yarn-berry.cjs:2:336683)
    at n.bindDescriptor (/Users/someone/a-react-app/.yarn/releases/yarn-berry.cjs:2:336048)
    at d (/Users/someone/a-react-app/.yarn/releases/yarn-berry.cjs:2:357409)
    at async Promise.all (index 0)
    at async ie.resolveEverything (/Users/someone/a-react-app/.yarn/releases/yarn-berry.cjs:2:358614)
    at async /Users/someone/a-react-app/.yarn/releases/yarn-berry.cjs:2:377271
    at async f.startTimerPromise (/Users/someone/a-react-app/.yarn/releases/yarn-berry.cjs:2:389740)
    at async ie.install (/Users/someone/a-react-app/.yarn/releases/yarn-berry.cjs:2:377210)
    at async /Users/someone/a-react-app/.yarn/releases/yarn-berry.cjs:2:33217
    at async Function.start (/Users/someone/a-react-app/.yarn/releases/yarn-berry.cjs:2:388437)
➤ YN0000: └ Completed
➤ YN0000: Failed with errors in 0s 110ms

Thanks for the workaround, @ikatyang On Yarn 2.4.0 after specifying the version tag, tailwindCSS works with yarn 2 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproducible This issue can be successfully reproduced
Projects
None yet
Development

No branches or pull requests

3 participants