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

Incompatible with Yarn 2 #993

Closed
araujogui opened this issue Apr 13, 2021 · 4 comments
Closed

Incompatible with Yarn 2 #993

araujogui opened this issue Apr 13, 2021 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@araujogui
Copy link

Describe the bug
Yarn 2.4.1 fails to run Svelte Kit's scripts.

Logs

➤ YN0000: ┌ Resolution step
➤ 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
➤ YN0002: │ @sveltejs/vite-plugin-svelte@npm:1.0.0-next.6 [6e7b7] doesn't provide rollup (p9cae2), requested by @rollup/pluginutils
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 11s 534ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ vite@npm:2.1.5 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ which@npm:2.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ wide-align@npm:1.1.3 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ wrappy@npm:1.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yallist@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 2s 749ms
➤ YN0000: ┌ Link step
➤ YN0007: │ svelte-preprocess@npm:4.7.0 [2d2f7] must be built because it never did before or the last one failed
➤ YN0000: └ Completed
➤ YN0000: Done with warnings in 14s 455ms
(node:5987) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/home/araujo/Área de trabalho/eurora.store/.yarn/$$virtual/@sveltejs-kit-virtual-6e7b74d398/0/cache/@sveltejs-kit-npm-1.0.0-next.74-7ec168993f-79c42c4576.zip/node_modules/@sveltejs/kit/svelte-kit.js:2
import './dist/cli.js';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:355:18)
    at wrapSafe (node:internal/modules/cjs/loader:1022:15)
    at Module._compile (node:internal/modules/cjs/loader:1056:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.external_module_.Module._load (/home/araujo/Área de trabalho/eurora.store/.pnp.cjs:6480:14)
    at Function.executeUserEntryPoint [as runMain] (node

To Reproduce
https://github.com/araujogui/svelte-kit-yarn

Stacktraces
Information about your SvelteKit Installation:

Diagnostics System: OS: Linux 5.11 Arch Linux CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz Memory: 365.53 MB / 7.65 GB Container: Yes Shell: 3.2.1 - /usr/bin/fish Binaries: Node: 15.14.0 - /usr/bin/node Yarn: 2.4.1 - /usr/bin/yarn npm: 7.9.0 - /usr/bin/npm Browsers: Brave Browser: 89.1.22.71

Severity
It entirely blocks my usage of SvelteKit.

Additional context
There's no issue when NPM or PNPM.

@thefrana
Copy link

Having the same problem, thanks for opening an issue.

@Conduitry
Copy link
Member

yarnpkg/berry#638 Yarn 2 does not support ESM in packages. We're not going to ship CJS just for the sake of Yarn 2. I'd suggest using a different package manager and watching that issue.

In the meantime, I am adding the 'documentation' label to this until we note somewhere in the docs or in the starter template that Yarn 1 is fine but Yarn 2 is not.

@Conduitry Conduitry added the documentation Improvements or additions to documentation label Apr 14, 2021
@Conduitry Conduitry changed the title SyntaxError: Cannot use import statement outside a module Incompatible with Yarn 2 Apr 14, 2021
@orta
Copy link

orta commented Apr 14, 2021

FWIW, that's yarn 2+ with PNP mode (which admittedly is their default).
It should probably work by using the node_modules resolver.

@Rich-Harris
Copy link
Member

I've updated the FAQ page, so will close this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

5 participants