Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Vite Dev Freezing / Hanging on Start with SvelteKit with Bun Dev #17851

Unanswered
AlbertMarashi asked this question in Q&A
Discussion options

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

You must be logged in to vote

Replies: 13 comments 16 replies

Comment options

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 dependencies
  • bun update - updated as above
  • bun dev - hung as Albert mentioned

If I had to guess I imagine this is a bun issue, not a vite one.

You must be logged in to vote
3 replies
Comment options

I'll test with npm run dev next time it occurs to see if it's uniquely a bun issue

Comment options

Notices with pnpm as well

Comment options

@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

Comment options

image

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)
You must be logged in to vote
3 replies
Comment options

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)
Comment options

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"]
Loading

Removing the extends from the root tsconfig.json resolves the hang issue and allows the build to continue as normal without issue.

Comment options

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"]
Loading

Removing the extends from the root tsconfig.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!

Comment options

Getting this and can't find a solution

You must be logged in to vote
2 replies
Comment options

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...

Comment options

tysm!

Comment options

You must be logged in to vote
0 replies
Comment options

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
You must be logged in to vote
2 replies
Comment options

Adapter bun? Is it a problem if I use adapter vercel?

Comment options

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

Comment options

It's still occuring for me on version 1.1.34. Weirdly, it only happens on my Mac, not my Linux workstation.

You must be logged in to vote
3 replies
Comment options

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

Comment options

I can confirm this is happening to me as well with Bun version 1.1.34 on my Mac.

Comment options

Still happening on macOS

Comment options

Issue confirmed on v1.2.0, MacOS. Deleting node_modules helped

You must be logged in to vote
0 replies
Comment options

Yeah this is definitely still happening for me. The only thing that fixes it is clearing node_modules...

You must be logged in to vote
2 replies
Comment options

It comes an goes with each version, definitely a regression testing issue

Comment options

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.

Comment options

This still happens.

You must be logged in to vote
1 reply
Comment options

I just now always do- bun install -f

Comment options

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).

You must be logged in to vote
0 replies
Comment options

Happy 1 year to this issue 🥳
(no pressure on maintainers, I'd love to contribute a fix but I'm dum dum)

You must be logged in to vote
0 replies
Comment options

@Jarred-Sumner still happening on bun very frequently with vite in monorepos.

You must be logged in to vote
0 replies
Comment options

Give me a year, I'll learn Zig and come back to this one !

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /