[Bug?]: New solid start doesn't work with yarn berry
Duplicates
- [X] I have searched the existing issues
Latest version
- [X] I have tested the latest version
Current behavior 😯
daniel@mmmmmmmmmm my-app % yarn
➤ YN0000: · Yarn 4.0.2
➤ YN0000: ┌ Resolution step
➤ YN0082: │ @esbuild/android-arm64@npm:0.19.10: No candidates found
➤ YN0000: └ Completed in 1s 720ms
➤ YN0000: · Failed with errors in 1s 730ms
Expected behavior 🤔
yarn install should complete successfully
Steps to reproduce 🕹
Follow this terminal log:
daniel@mmmmmmmmmm test % npm init solid@latest
Need to install the following packages:
[email protected]
Ok to proceed? (y) y
create-solid version 0.4.0-alpha.0
Welcome to the SolidStart setup wizard!
There are definitely bugs and some feature might not work yet.
If you encounter an issue, have a look at https://github.com/solidjs/solid-start/issues and open a new one, if it is not already tracked.
✔ Where do you want to create the app? … my-app
✔ Which template do you want to use? › bare
✔ Server Side Rendering? … yes
✔ Use TypeScript? … yes
found matching commit hash: be388d58737ced31b0ed78cd8128f83c2b0a319b
downloading https://github.com/solidjs/solid-start/archive/be388d58737ced31b0ed78cd8128f83c2b0a319b.tar.gz to /Users/daniel/.degit/github/solidjs/solid-start/be388d58737ced31b0ed78cd8128f83c2b0a319b.tar.gz
extracting /examples/bare from /Users/daniel/.degit/github/solidjs/solid-start/be388d58737ced31b0ed78cd8128f83c2b0a319b.tar.gz to /private/tmp/test/my-app/.solid-start
cloned solidjs/solid-start#main to /private/tmp/test/my-app/.solid-start
✔ Copied project files
Next steps:
1: cd my-app
2: npm install
3: npm run dev -- --open
To close the dev server, hit Ctrl-C
^C
daniel@mmmmmmmmmm test % cd my-app
daniel@mmmmmmmmmm my-app % rm -rf node_modules package-lock.json
daniel@mmmmmmmmmm my-app % yarn set version berry
warning package.json: No license field
(node:22152) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
➤ YN0000: Retrieving https://repo.yarnpkg.com/4.0.2/packages/yarnpkg-cli/bin/yarn.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-4.0.2.cjs
➤ YN0000: Done in 0s 675ms
daniel@mmmmmmmmmm my-app % yarn
➤ YN0000: · Yarn 4.0.2
➤ YN0000: ┌ Resolution step
➤ YN0082: │ @esbuild/android-arm64@npm:0.19.10: No candidates found
➤ YN0000: └ Completed in 4s 230ms
➤ YN0000: · Failed with errors in 4s 238ms
Context 🔦
I want to use the latest version of yarn which is fast and also supports yarn link so I can link my locally built packages.
Your environment 🌎
Node v21.5.0 on macOS 14.2.1 (23C71)
M1 Max 16" MacBook Pro
If we are basing it on the esbuild log, then this is an esbuild issue, not SolidStart's. Pardon me because I don't see anything related to SolidStart's setup.
@danieltroger I get this
➜ yarn add @esbuild/android-arm64 ➤ YN0000: · Yarn 4.0.2 ➤ YN0000: ┌ Resolution step ➤ YN0085: │ + @esbuild/android-arm64@npm:0.19.10 ➤ YN0000: └ Completed ➤ YN0000: ┌ Fetch step ➤ YN0013: │ A package was added to the project (+ 9.37 MiB). ➤ YN0000: └ Completed in 1s 99ms ➤ YN0000: ┌ Link step ➤ YN0000: └ Completed ➤ YN0000: · Done in 1s 140ms
This could be related to the environment / hardware / os you use, and the compatibility with that, yarn berry and @esbuild/android-arm64. It's probably best to open an issue on it in here: https://github.com/evanw/esbuild/issues with as much information about your setup as possible
@birkskyum thanks for testing. For some reason it now works flawlessly - yarn install succeeds. Must have been a fluke.
However, now when doing yarn dev I run into this:
daniel@mmmmmmmmmm my-app % yarn dev
Error: Package subpath './lib/chunks' is not defined by "exports" in /Users/daniel/.yarn/berry/cache/vinxi-npm-0.0.54-94f4086925-10c0.zip/node_modules/vinxi/package.json imported from /private/tmp/test/my-app/.yarn/__virtual__/@vinxi-server-functions-virtual-824b5314c0/5/Users/daniel/.yarn/berry/cache/@vinxi-server-functions-npm-0.0.51-9542aa8426-10c0.zip/node_modules/@vinxi/server-functions/
Require stack:
- /private/tmp/test/my-app/.yarn/__virtual__/@vinxi-server-functions-virtual-824b5314c0/5/Users/daniel/.yarn/berry/cache/@vinxi-server-functions-npm-0.0.51-9542aa8426-10c0.zip/node_modules/@vinxi/server-functions/client.js
at require$$0.Module._resolveFilename (/private/tmp/test/my-app/.pnp.cjs:12657:13)
at Function.resolve (node:internal/modules/helpers:187:19)
at _resolve (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:251148)
at jiti (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:253746)
at /private/tmp/test/my-app/.yarn/__virtual__/@vinxi-server-functions-virtual-824b5314c0/5/Users/daniel/.yarn/berry/cache/@vinxi-server-functions-npm-0.0.51-9542aa8426-10c0.zip/node_modules/@vinxi/server-functions/client.js:3:15
at evalModule (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:256443)
at jiti (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:254371)
at /private/tmp/test/my-app/.yarn/__virtual__/@vinxi-server-functions-virtual-824b5314c0/5/Users/daniel/.yarn/berry/cache/@vinxi-server-functions-npm-0.0.51-9542aa8426-10c0.zip/node_modules/@vinxi/server-functions/plugin.js:3:15
at evalModule (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:256443)
at jiti (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:254371)
Let me know if it doesn't happen for you
@danieltroger , when i use yarn 1.x it works alright (both install and dev server), but with berry I always have a new package failing to install, like:
➜ yarn
➤ YN0000: · Yarn 4.0.2
➤ YN0000: ┌ Resolution step
➤ YN0082: │ npm-run-path@npm:^5.1.0: No candidates found
➤ YN0000: └ Completed in 0s 475ms
➤ YN0000: · Failed with errors in 0s 487ms
or deleting node modules and retrying:
➤ YN0000: · Yarn 4.0.2
➤ YN0000: ┌ Resolution step
➤ YN0082: │ lru-cache@npm:^10.0.2: No candidates found
➤ YN0000: └ Completed in 5s 713ms
➤ YN0000: · Failed with errors in 5s 722ms
so it looks like to me that yarn berry is flaky.
berry has a different module resolution so it may or may not be Berry's fault.
I've never seen this flake before in yarn 3+ and I've been using it professionally for ~2 years 😅 Maybe that's because we have enableGlobalCache: false in most work projects' .yarnrc.yml?
It seems like there's an issue for it already: https://github.com/yarnpkg/berry/issues/5989
Can you try if rm -rf ~/.yarn/berry/metadata/npm solves it for you and then look into Error: Package subpath './lib/chunks' is not defined by "exports" or do you want me to open a separate issue for that?
i tried deleting all the yarn things:
.yarnrc.yml,.yarnfolder"packageManager": "[email protected]"in package.json
I then ran:
yarn set version berryyarn
My result was:
➜ yarn
➤ YN0087: Migrated your project to the latest Yarn version 🚀
➤ YN0000: · Yarn 4.0.2
➤ YN0000: ┌ Resolution step
➤ YN0082: │ npm-run-path@npm:^5.1.0: No candidates found
➤ YN0000: └ Completed in 1s 989ms
➤ YN0000: · Failed with errors in 2s 1ms
Did you also delete the yarn folder in your home directory? ~/.yarn/berry/metadata/npm
~ means your home folder, so $HOME
oh way, the on in ~/.yarn I missed! now I get:
➜ yarn
➤ YN0065: Yarn will periodically gather anonymous telemetry: https://yarnpkg.com/advanced/telemetry
➤ YN0065: Run yarn config set --home enableTelemetry 0 to disable
➤ YN0000: · Yarn 4.0.2
➤ YN0000: ┌ Resolution step
➤ YN0085: │ + @solidjs/meta@npm:0.29.3, @solidjs/router@npm:0.10.5, @solidjs/start@npm:0.4.2, solid-js@npm:1.8.7, and 621 more.
➤ YN0000: └ Completed in 7s 937ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ 559 packages were added to the project (+ 168.09 MiB).
➤ YN0000: └ Completed in 2s 624ms
➤ YN0000: ┌ Link step
➤ YN0007: │ esbuild@npm:0.18.20 must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.19.10 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 2s 62ms
➤ YN0000: · Done in 12s 684ms
Epic, it worked! Now try yarn dev
Hello world counter works as expected
➜ yarn dev
start {
appRoot: './src',
ssr: true,
islands: false,
server: { base: undefined },
solid: {}
}
vinxi hook app:config-resolved 11:43:09 AM
vinxi hook app:created 11:43:10 AM
vinxi Found vite.config.js with app config
/*404
/
/*404
/
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
Whaatt, I'll also try clearing all my caches then
What's your node version btw?
v18.19.0
Can you try on latest? My node install is bricked by trying to get asdf to work to get old solid start docs to work because I needed to read them because I couldn't update because of this so I need to fix my node before I can get back to reproducing
sure, I swapped to node 20.10.0 using nvm and ran yarn, yarn dev, and it starts the dev server alright as well.
Interesting, what about 21.5.0?
checked just now - 21.5.0 works as well for me.
I tried adding the Vite 5 resolution as well:
"resolutions": {
"vite": "5"
},
that that works as well for me. both dev build and start
Soo weird. I'm back on 21.5.0 now. Deleted ~/.yarn/berry/metadata/npm as well as ~/.yarn/berry/cache and re-did the solid start setup along with yarn setup and yarn dev still gives me
daniel@mmmmmmmmmm my-app % yarn dev
Error: Package subpath './lib/chunks' is not defined by "exports" in /Users/daniel/.yarn/berry/cache/vinxi-npm-0.0.54-94f4086925-10c0.zip/node_modules/vinxi/package.json imported from /private/tmp/solid-start-x/my-app/.yarn/__virtual__/@vinxi-server-functions-virtual-824b5314c0/5/Users/daniel/.yarn/berry/cache/@vinxi-server-functions-npm-0.0.51-9542aa8426-10c0.zip/node_modules/@vinxi/server-functions/
Require stack:
- /private/tmp/solid-start-x/my-app/.yarn/__virtual__/@vinxi-server-functions-virtual-824b5314c0/5/Users/daniel/.yarn/berry/cache/@vinxi-server-functions-npm-0.0.51-9542aa8426-10c0.zip/node_modules/@vinxi/server-functions/client.js
at require$$0.Module._resolveFilename (/private/tmp/solid-start-x/my-app/.pnp.cjs:12657:13)
at Function.resolve (node:internal/modules/helpers:187:19)
at _resolve (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:251148)
at jiti (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:253746)
at /private/tmp/solid-start-x/my-app/.yarn/__virtual__/@vinxi-server-functions-virtual-824b5314c0/5/Users/daniel/.yarn/berry/cache/@vinxi-server-functions-npm-0.0.51-9542aa8426-10c0.zip/node_modules/@vinxi/server-functions/client.js:3:15
at evalModule (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:256443)
at jiti (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:254371)
at /private/tmp/solid-start-x/my-app/.yarn/__virtual__/@vinxi-server-functions-virtual-824b5314c0/5/Users/daniel/.yarn/berry/cache/@vinxi-server-functions-npm-0.0.51-9542aa8426-10c0.zip/node_modules/@vinxi/server-functions/plugin.js:3:15
at evalModule (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:256443)
at jiti (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:254371)
Can you send me your yarn.lock?
Thanks, here's my whole directory if running yarn dev in there gets you the same error? Contains the vite 5 resolution but still same error
Same issue even with your lockfile 🤨 this is peak weird. Do you think it'd be more helpful if I tried to dig into the actual issue or created a Dockerfile that reproduces the issue for you?
WAIT, you don't happen to get a node_modules folder for some reason? Can you set nodeLinker: pnp in your .yarnrc.yml to force yarn to use pnp?
it seems like I was able to reproduce your error when using the bare template. What I have been able to run so far was the basic template that includes the router (apparently didn't read your reproduction steps closely enough, but it became clear by comparing to the zip you shared).
Niiice! I could have been clearer with this choice in my initial bug report, sorry for that.
What I've figured out so far is that
- This is from where the failing import comes
lib/chunksis declared invinxis package.json#exports map
This means something's up with the module resolution probably
The stack printed by the error message contains suspiciously little yarn module resolution, currently looking into what jiti is as that seems sus
at require$$0.Module._resolveFilename (/private/tmp/solid-start-x/my-app/.pnp.cjs:12701:13)
at Function.resolve (node:internal/modules/helpers:187:19)
at _resolve (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:251148)
at jiti (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:253746)
at /private/tmp/solid-start-x/my-app/.yarn/unplugged/@vinxi-server-functions-virtual-824b5314c0/node_modules/@vinxi/server-functions/client.js:3:15
at evalModule (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:256443)
at jiti (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:254371)
at /private/tmp/solid-start-x/my-app/.yarn/unplugged/@vinxi-server-functions-virtual-824b5314c0/node_modules/@vinxi/server-functions/plugin.js:3:15
at evalModule (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:256443)
at jiti (/Users/daniel/.yarn/berry/cache/jiti-npm-1.21.0-baebd5985a-10c0.zip/node_modules/jiti/dist/jiti.js:1:254371)
Uh-oh… Is it possible that someone is using some home-brewed module resolution which doesn't speak yarn?
@birkskyum any idea if this could be the culprit?
@danieltroger , i think it could be.. while it was needed initially, I find it's increasingly starting to be more in the way, than actually being helpful as recognized here as well.
It's holding back deno support as well
- https://github.com/denoland/deno/issues/20607