-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Vite Dev Freezing / Hanging on Start with SvelteKit with Bun Dev #17851
-
Describe the bug
I have vite dev
freezing on when I run bun dev
in two of my SvelteKit projects.
I want to know if anyone else is having this issue, or whether it's a local thing
Not sure if it's related to #11468 but it is a quite annoying and recurring issue
Reproduction
Difficult to Reproduce
Steps to reproduce
It happens quite often when I update a dependency and I run bun dev
it just hangs and freezes even if I re-run it the only thing that fixes it is deleting all node modules with rm -r node_modules
System Info
System: OS: macOS 14.2 CPU: (8) arm64 Apple M1 Pro Memory: 152.56 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node npm: 10.7.0 - ~/.nvm/versions/node/v20.15.0/bin/npm bun: 1.1.18 - ~/.bun/bin/bun Browsers: Chrome: 127.0.6533.99 Safari: 17.2 npmPackages: vite: ^5.4.0 => 5.4.0
Used Package Manager
bun
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 13 comments 16 replies
-
I've also just had this after updating everything to latest.
I updated:
"@sveltejs/kit": "^2.5.18" -> "^2.5.21"
"svelte": "^5.0.0-next.174" -> "^5.0.0-next.210"
"vite": "^5.3.3" -> "^5.4.0"
When going back to the project I ran:
bun dev
- running with previous dependenciesbun update
- updated as abovebun dev
- hung as Albert mentioned
If I had to guess I imagine this is a bun issue, not a vite one.
Beta Was this translation helpful? Give feedback.
All reactions
-
I'll test with npm run dev
next time it occurs to see if it's uniquely a bun issue
Beta Was this translation helpful? Give feedback.
All reactions
-
Notices with pnpm as well
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2
-
@jhwz @xmlking have any of you guys figured out how to reproduce this? It happens all the time for me but it's random, usually after updating a dependency
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
This is the error that appears nowadays
failed to load config from /repos/siteforge-app/vite.config.ts
error when starting dev server:
Error: The service was stopped
at /repos/siteforge-app/node_modules/esbuild/lib/main.js:968:34
at responseCallbacks.<computed> (/repos/siteforge-app/node_modules/esbuild/lib/main.js:622:9)
at Socket.afterClose (/repos/siteforge-app/node_modules/esbuild/lib/main.js:613:28)
at Socket.emit (node:events:531:35)
at endReadableNT (node:internal/streams/readable:1696:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Beta Was this translation helpful? Give feedback.
All reactions
-
Not using bun, but I'm running into this same error message- What repo structure do you have? I'm using a monorepo with per-package tsconfig.json
configs, and can reproduce the issue by creating a root-level tsconfig.json
. Once I do that, esbuild
starts hanging and blocking the vite build. Haven't found a workaround yet.
Things were fine, but in one of the recent typescript-eslint
updates, it started throwing errors unless there was a root-level tsconfig.json
, so I'm stuck between a rock and a hard place.
Currently using:
- Yarn 4.3.1 w/ pnp
- vite 5.4.3
- Typescript 5.5.4
- eslint 9.10
- typescript-eslint 8.5.0 (
typescript-eslint/parser
is at the same version)
Beta Was this translation helpful? Give feedback.
All reactions
-
I managed to find a workaround and traced the issue in my configuration. esbuild
seems to hang when extending tsconfigs from a local package (this may also impact extending from external packages, but I haven't tested it).
My structure of the root tsconfig.json
is arranged as:
flowchart LR
subgraph tsconfig-shared
base -->|extends: ./base| node
end
node -->|extends: tsconfig-shared/node| root-tsc["/tsconfig.json"]
Removing the extends
from the root tsconfig.json
resolves the hang issue and allows the build to continue as normal without issue.
Beta Was this translation helpful? Give feedback.
All reactions
-
👀 2
-
I managed to find a workaround and traced the issue in my configuration.
esbuild
seems to hang when extending tsconfigs from a local package (this may also impact extending from external packages, but I haven't tested it).My structure of the root
tsconfig.json
is arranged as: Loadingflowchart LR subgraph tsconfig-shared base -->|extends: ./base| node end node -->|extends: tsconfig-shared/node| root-tsc["/tsconfig.json"]Removing the
extends
from the roottsconfig.json
resolves the hang issue and allows the build to continue as normal without issue.
This actually fixed it for me, I moved the config I was extending from svelte-kit
into my main tsconfig and all seems well now!
Beta Was this translation helpful? Give feedback.
All reactions
-
Getting this and can't find a solution
Beta Was this translation helpful? Give feedback.
All reactions
-
You need to rm -rf node_modules
or install with force clear cache options. I think this is due to Bun and pnpm's folder linking
bun i --force
should also work. Yes, this is very annoying until the issue gets fixed...
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 11 -
❤️ 3
-
tysm!
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.
All reactions
-
Looks like it was fixed eventually. If anyone still experiences this, try upgrading to:
bun: 1.1.34
vite@5.4.9
svelte@5.1.2
@sveltejs/vite-plugin-svelte@4.0.0
@sveltejs/kit@2.7.3
svelte-adapter-bun@0.5.2
Beta Was this translation helpful? Give feedback.
All reactions
-
Adapter bun? Is it a problem if I use adapter vercel?
Beta Was this translation helpful? Give feedback.
All reactions
-
Adapter bun? Is it a problem if I use adapter vercel?
I'm not Bun or Vite contributor but I believe the fix was introduced in Bun somewhere between 1.1.30 and 1.1.34
Sorry I don't have much time to test exactly what and where and how was fixed, I just providede the versions that does not seem to trigger that issue anymore.
I doubt that the fix was in svelte-adapter-bun since we're using different adapters and had same issue, I believe bun's adapter did not cause this issue in the first place
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
It's still occuring for me on version 1.1.34. Weirdly, it only happens on my Mac, not my Linux workstation.
Beta Was this translation helpful? Give feedback.
All reactions
-
Yep, I can confirm it started happening again, though I remember I fixed it and even agter installing new packages I was able to start the server
Beta Was this translation helpful? Give feedback.
All reactions
-
I can confirm this is happening to me as well with Bun version 1.1.34
on my Mac.
Beta Was this translation helpful? Give feedback.
All reactions
-
Still happening on macOS
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 13
-
Issue confirmed on v1.2.0, MacOS. Deleting node_modules helped
Beta Was this translation helpful? Give feedback.
All reactions
-
Yeah this is definitely still happening for me. The only thing that fixes it is clearing node_modules
...
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 5
-
It comes an goes with each version, definitely a regression testing issue
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Yes, this keeps on coming back between version upgrades.
Its 'not great.
Even more annoying if the docker build process hangs because somehow vite build does not signal completion.
that's when we start without a node_modules folder.
Beta Was this translation helpful? Give feedback.
All reactions
-
This still happens.
Beta Was this translation helpful? Give feedback.
All reactions
-
I just now always do- bun install -f
Beta Was this translation helpful? Give feedback.
All reactions
-
Just happened to me but without bun.
Sveltekit+Vite+SASS, but the bug is the same (on Windows 11).
After changing part of the css/styles, the page (localhost) suddenly got stuck loading. I'm using SASS.
Tried, but didn't fix:
- Changing the server in vite.config.ts
- Commenting out the css I changed
- Restarting the computer
- Restarting vscode
- Cleaning cache, deleting node_modules and reinstalling packages using npm
My problem was a circular reference in SASS (that didn't look like it).
Beta Was this translation helpful? Give feedback.
All reactions
-
Happy 1 year to this issue 🥳
(no pressure on maintainers, I'd love to contribute a fix but I'm dum dum)
Beta Was this translation helpful? Give feedback.
All reactions
-
@Jarred-Sumner still happening on bun very frequently with vite in monorepos.
Beta Was this translation helpful? Give feedback.
All reactions
-
Give me a year, I'll learn Zig and come back to this one !
Beta Was this translation helpful? Give feedback.