kit icon indicating copy to clipboard operation
kit copied to clipboard

`adapter-cloudflare-workers` does not work with Yarn 2

Open whispersofthedawn opened this issue 5 years ago • 6 comments

Describe the bug When installing @sveltejs/adapter-cloudflare-workers with Yarn 2, You run into an error about the workspace not being found. This is caused by this code, and the fact that this is published with pnpm: https://github.com/sveltejs/kit/blob/master/packages/adapter-cloudflare-workers/package.json#L23-L25

Logs

Logs
yarn add -D @sveltejs/adapter-cloudflare-workers
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: @sveltejs/kit@workspace:*: Workspace not found (@sveltejs/kit@workspace:*)
    at ie.getWorkspaceByDescriptor (C:\Users\myname\Downloads\portfolio\.yarn\releases\yarn-2.4.2.cjs:2:360510)
    at n.getCandidates (C:\Users\myname\Downloads\portfolio\.yarn\releases\yarn-2.4.2.cjs:2:408948)
    at n.getCandidates (C:\Users\myname\Downloads\portfolio\.yarn\releases\yarn-2.4.2.cjs:2:342946)
    at n.getCandidates (C:\Users\myname\Downloads\portfolio\.yarn\releases\yarn-2.4.2.cjs:2:342946)
    at C:\Users\myname\Downloads\portfolio\.yarn\releases\yarn-2.4.2.cjs:2:364602
    at Module.w (C:\Users\myname\Downloads\portfolio\.yarn\releases\yarn-2.4.2.cjs:2:424073)
    at C (C:\Users\myname\Downloads\portfolio\.yarn\releases\yarn-2.4.2.cjs:2:364565)
➤ YN0000: └ Completed
➤ YN0000: Failed with errors in 0s 110ms

To Reproduce Reproduction repo: https://github.com/dawnofmidnight/cloudflare-adapter-reproduction

Simply clone and run yarn and yarn add -D @sveltejs/adapter-cloudflare-workers

Expected behavior I expected the package to install fine as it would elsewhere.

Information about your SvelteKit Installation:

Diagnostics
System:
    OS: Windows 10 10.0.19043
    CPU: (8) x64 AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx
    Memory: 517.84 MB / 6.90 GB
  Binaries:
    Node: 14.17.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 2.4.2 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 6.14.13 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1023.0), Chromium (91.0.864.54)
  npmPackages:
    @sveltejs/kit: next => 1.0.0-next.116
    svelte: ^3.34.0 => 3.38.3

Browser:
  Firefox Developer Edition Version 90.0b10 (64-bit)

Severity This bug honestly doesn't effect me too much, since I'm using this for a personal project and can just export it statically or use another package manager anyway. But, for those who are using this in production, it may be a bigger issue

whispersofthedawn avatar Jun 22 '21 22:06 whispersofthedawn

See "Does it work with Yarn 2?" under https://kit.svelte.dev/faq#integrations - None of Kit works will with Yarn 2 because they do not support ESM packages.

Conduitry avatar Jun 22 '21 22:06 Conduitry

Oh, my bad. But I'm not using the pnp feature at all, so I don't see why that would apply.

whispersofthedawn avatar Jun 22 '21 22:06 whispersofthedawn

@Conduitry If you actually read the issue you would have seen that it's unrelated to Yarn (and a duplicate of https://github.com/sveltejs/kit/issues/1710), the package in question is published with a dependency specified as "@sveltejs/kit": "workspace:*" which is invalid.

https://registry.yarnpkg.com/@sveltejs/adapter-cloudflare-workers/0.0.1

None of Kit works will with Yarn 2 because they do not support ESM packages.

Yarn PnP doesn't support it, Yarn 2 supports node_modules which works fine with ESM.

merceyz avatar Jun 22 '21 22:06 merceyz

Simply clone and run yarn and yarn add -D @sveltejs/adapter-cloudflare-workers

The correct tag is @next.

yarn add -D @sveltejs/adapter-cloudflare-workers@next

GrygrFlzr avatar Jun 22 '21 22:06 GrygrFlzr

@merceyz I never actually read issues

Conduitry avatar Jun 22 '21 22:06 Conduitry

Simply clone and run yarn and yarn add -D @sveltejs/adapter-cloudflare-workers

The correct tag is @next.

yarn add -D @sveltejs/adapter-cloudflare-workers@next

I'll try that, thank you.

Edit: That works, thank you for the info

whispersofthedawn avatar Jun 22 '21 22:06 whispersofthedawn