Registry Mirror
Skip to content

Page reload causes stream/headers errors and crashes on clean Nuxt install  #1081

Closed

Description

@Gwynerva

Environment

Windows 11
Node 24 and 22
npm or bun
Nuxt 4 (reproduced on 4.0.0, 4.1.0 and 4.1.3)

Reproduction

Create a clean fresh empty Nuxt 4 project.
Run Nuxt in dev mode npm/bun dev, disable caching in browser options (not requried but helps to reproduce more reliably), start spamming page refresh command (Ctrl + R) and you will see errors in terminal.

Describe the bug

In dev mode (and only in dev) when refreshing the page Nuxt sometimes log stream errors:

Image Image

I would just ignore them, but sometimes they crash the Nuxt entirely, triggering full restart (not just server but whole Nuxt):

nuxt-stream-bug.mp4

Additional context

Would not say it is critical, but indeed it is annoying and happens even without fast refreshing.
It also errors only in dev mode. In build or generate mode I did not manage to reproduce it no matter how fast I spam page refresh.

Also it seems I started to notice it only yersterday and fell like everything was alright before... Maybe have not noticed or did not payed attention earlier...

Activity

  1. changed the title [-]Premature close / Cannot pipe to a closed or destroyed stream / Cannot set headers after they are sent to the client[/-] [+]Page reload cause stream/headers errors and crashes on clean Nuxt install [/+] on Oct 9, 2025
  2. changed the title [-]Page reload cause stream/headers errors and crashes on clean Nuxt install [/-] [+]Page reload causes stream/headers errors and crashes on clean Nuxt install [/+] on Oct 9, 2025
  3. SveinnB commented on Oct 9, 2025

    @SveinnB

    Yeah, I spent all day yesterday debugging this.
    I think it only happens on Windows. I don't have mac to test.
    I managed to get rid of it by downgrading @nuxt/cli to 3.28.0.
    in package.json

      "pnpm": {
        "overrides": {
          "@nuxt/cli": "3.28.0"
        }
      },
    

    I saw this issue nuxt/nuxt#33410 and tried this.

  4. SveinnB commented on Oct 9, 2025

    @SveinnB

    This will probably be solved in next version of nuxt/cli
    See @danielroe is working on this ...
    4509643

  5. transferred this issue fromnuxt/nuxton Oct 9, 2025
  6. Gwynerva commented on Oct 9, 2025

    @Gwynerva
    Author

    @SveinnB Cool, thanks for workaround and mentioning this is likely solving right now! I guess I will just wait for bug fix because it is not like critical for me.

  7. StirStudios commented on Oct 9, 2025

    @StirStudios

    Hey @Gwynerva, @SveinnB — just wanted to chime in since we were running into the same issue, and it seemed totally random. It only started after upgrading to Nuxt 4.1.3.

    As soon as we applied @SveinnB’s workaround:

     "pnpm": {
        "overrides": {
          "@nuxt/cli": "3.28.0"
        }
      },

    — the issue was resolved.

    For context, we’re on macOS, using DDEV, and running pnpm and pm2 inside the container.

  8. NtchPlayer commented on Oct 9, 2025

    @NtchPlayer

    Yes I got the same error on my application after upgrading to Nuxt 4.1.3.

    Node v22.20.0

  9. SveinnB commented on Oct 9, 2025

    @SveinnB

    Testing the new version 3.29.3
    Image

    The "Cannot set headers ..." and "Cannot pipe to closed ..." are gone.

    But the "Premature close" is still here

    Image
  10. ahoiroman commented on Oct 11, 2025

    @ahoiroman

    I got

    invalid connection header

    with the latest release. Makes Nuxt unusable for me at the moment. I'm trying to find a state to pin packages in order to get my dev setup working again.

  11. StirStudios commented on Oct 11, 2025

    @StirStudios

    @ahoiroman you need to pin your packages with this

     "pnpm": {
        "overrides": {
          "@nuxt/cli": "3.28.0"
        }
      },
  12. shroomlife commented on Oct 15, 2025

    @shroomlife

    Same here with Bun 1.3 and Nuxt 4.1.3.

  13. lauriscodes commented on Oct 17, 2025

    @lauriscodes

    Can confirm that i have the same issue.

    Image

    Seems like problem is persistent on windows machines only. I have got Windows 11.
    Image

    Workaround which was suggested by @SveinnB definitely helps ! So, Thank You !

  14. Vice-108 commented on Oct 19, 2025

    @Vice-108

    any fixes for windows 11 and npm
    ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions