Websockets stopped working - no live reloads
My nuxt 4 projects mysteriously stopped connecting via ws for live reloads. Any idea how to debug that?

3 Replies
Hi @JohnBoblem. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Here are focused steps to debug Nuxt 4 HMR WebSocket issues based on the sources:
- Check the dev server WebSocket endpoint and errors in the browser console/network tab. Common errors include handshake timeout or connection refused; Vite will print a hint showing which host/port it’s trying to reach. [hmr not work]
- Ensure your HMR server is reachable from your browser/network setup. If you run inside Docker/behind a proxy, expose host/port correctly (e.g., HOST/PORT env, or host 0.0.0.0). [Dockerized nginx]
- If you’re using Bun, try disabling process forking which can break HMR websockets: run dev with: nuxt dev --no-fork (you can add flags like --clipboard --no-clear). [hmr not work]
- If using Nuxt Content’s watcher, its WebSocket server has its own port you can set or disable; mismatches can confuse local setups. [Content watch]
- Recent Nuxt CLI fixes addressed dev-server connection instability in v4; ensure @nuxt/cli updated (lockfile can pin older versions). Users reported fewer HMR issues after the CLI update; some still saw ECONNRESET without repro, so version parity matters. [ECONNRESET thread]
- For “stopped suddenly” cases, double-check odd causes like component naming that prevented HMR from applying updates (e.g., auto-import naming). [HMR not reloading]
- Use Nuxt’s debugging aids:
- Enable sourcemaps for clearer stack traces. [Debugging guide]
- Start with inspector to watch server logs closely: nuxt dev --inspect. [Debugging guide]
- If HMR fails mid-session, watch for errors like “socket hang up/ECONNRESET”. A CLI fix was released; updating and reinstalling deps (and regenerating lockfile) helped some users. [ECONNRESET thread]
- As a last resort for chunk load errors causing reload loops, you can rely on Nuxt’s immediate chunk reload plugin (and its baseURL fix) if your issue manifests as chunk errors rather than WS connection, but that’s for recovery, not WS connectivity. [chunk-reload immediate; base URL fix]
If you can share:
- your dev command (Node/Bun, flags),
- network/proxy/Docker setup,
- browser console errors (exact WS URL/ports),
I can help pinpoint the misconfiguration.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
<@447739038250565642> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Thanks. --no-fork worked - I'm on bun