Skip to content

ERROR [unhandledRejection] read ECONNRESET #23832

Closed
nuxt/cli
#975

Description

@joansgarcia

Environment

  • Operating System: Linux
  • Node Version: v18.18.2
  • Nuxt Version: 3.7.4
  • CLI Version: 3.9.0
  • Nitro Version: 2.6.3
  • Package Manager: [email protected]
  • Builder: -
  • User Config: app, devtools, modules, css, ui, colorMode, postcss
  • Runtime Modules: @nuxt/[email protected], @nuxt/[email protected]
  • Build Modules: -

Reproduction

Sorry, I can't share code due to corporate law... I hope you understand. 🙏

Describe the bug

When I am programming for a long time nuxt gives me that server error apparently and it is usually tedious because I have to start everything again

 Vite server hmr 17 files in 10811.276ms

 ERROR  [unhandledRejection] connect ECONNREFUSED 127.0.0.1:41119  10:57:18 AM

  at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

Additional context

No response

Logs

Vite server hmr 17 files in 10811.276ms

 ERROR  [unhandledRejection] connect ECONNREFUSED 127.0.0.1:41119  10:57:18 AM

  at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

Activity

  1. github-actions commented on Oct 20, 2023

    @github-actions
    Contributor

    Would you be able to provide a reproduction? 🙏

    More info

    Why do I need to provide a reproduction?

    Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.

    What will happen?

    If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritize it based on its severity and how many people we think it might affect.

    If needs reproduction labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), we'll close them. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.

    How can I create a reproduction?

    We have a couple of templates for starting with a minimal reproduction:

    👉 https://stackblitz.com/github/nuxt/starter/tree/v3-stackblitz
    👉 https://codesandbox.io/s/github/nuxt/starter/v3-codesandbox

    A public GitHub repository is also perfect. 👌

    Please ensure that the reproduction is as minimal as possible. See more details in our guide.

    You might also find these other articles interesting and/or helpful:

  2. danielroe commented on Oct 20, 2023

    @danielroe
    Member

    Do you have a custom HMR port? Is 41119 the port your main Nuxt dev server is running on?

  3. adam-artisan-studio commented on Oct 20, 2023

    @adam-artisan-studio

    I believe this one is extremely difficult to reproduce and perhaps an issue somewhere with the local env setup.
    Also no custom HMR port defined this side.

    This is one of the reasons I have not reported this myself. Even after completely reinstalling node pnpm this issue still occurs.

    However @castrogarciajs perhaps this will help as a short term workaround

    ✔ Nitro built in 6575 ms                                                                                                                                                                                                                        nitro 11:52:46 PM
    ℹ Vite client warmed up in 14274ms                                                                                                                                                                                                                    11:52:47 PM
    (node:80030) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
    (Use `node --trace-warnings ...` to show where the warning was created)
    
     ERROR  [unhandledRejection] connect ETIMEDOUT 127.0.0.1:55605                                                                                                                                                                                         11:53:36 PM
    
      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16)

    This port will of course change every time you restart the dev server.
    My current workaround is to use http://127.0.0.1:55605/ which works then without any timeout issues

    I think this perhaps relates to layers and directed at more complexed nuxt projects.
    With a clean install without any 3rd party modules or plugins this doesn't happen.


    Environment


  4. htkarabulut commented on Oct 22, 2023

    @htkarabulut

    I'm experiencing the same issue. I'm using a package called node-rfc, which seems to be the root cause of the problem. I suspect the issue arises because this module has some C++ code bindings, and attempting hot reloading crashes the entire application. From my experience, the HTTP server doesn't crash but instead fully freezes. It becomes unresponsive to any requests, although it continues to listen on the port. I was planning to create a new issue when I find the time and can reproduce the problem in a minimal project, but I came across this and wanted to leave a comment.

  5. htkarabulut commented on Oct 22, 2023

    @htkarabulut

    I forgot to mention the most important part: The code will work the first time I start the server, but it freezes whenever I make a change and save it. However, it only freezes when I make a change on the server-side, not on the client-side.

    It is extremely annoying to Ctrl+C and restart every time I make a change.

  6. htkarabulut commented on Oct 22, 2023

    @htkarabulut

    I've successfully reproduced the problem in a minimal project. However, it's important to note that the node-rfc module relies on a licensed system library named nwrfcsdk, which includes a set of Linux .so library files. If you're interested, I can grant you access to the repository so that you can examine it and give it a try. Unfortunately, I'm unable to share this on StackBlitz or CodeSandbox due to their limitations. StackBlitz doesn't support file uploads, so I can't provide the nwrfcsdk. Additionally, I encountered various difficulties on CodeSandbox and couldn't proceed.

    Please let me know your GitHub usernames so that I can invite you to the repository. I've already invited danielroe to the repository, which you can find here. If you have the time, we could arrange a screen-sharing session for further assistance.

    I also attempted to address the issue by adding the following code snippet to nuxt.config.ts, but it didn't resolve the problem:

    vite: {
      optimizeDeps: {
        exclude: ['node-rfc'],
      },
    }

    One more challenge I encountered is that when I run npm run build and attempt to start it with node .output/server/index.mjs, an error related to node-rfc occurs. This issue is resolved when I manually copy the node_modules/node-rfc to .output/server/node_modules/node-rfc/.

  7. joansgarcia commented on Oct 24, 2023

    @joansgarcia
    Author

    @danielroe

    Hello,

    It is impossible to make a reproduction, because it is an error that happens during development and I cannot capture the exact moment of the error. I just have to close everything again.

    I don't have a custom port, I work with the default nuxt configuration.

  8. productdevbook commented on Oct 26, 2023

    @productdevbook
    Member

    I think this happens in projects with db connection, I get the same error sometimes.

    Does everyone have a db connection in the project?

  9. adam-artisan-studio commented on Oct 26, 2023

    @adam-artisan-studio

    @productdevbook I don't think this issue is related to the db connection.
    In our headless e-commerce stack we are using nitro connecting through to Laravel

    Most of our endpoints use useAsyncData catchall to hit nuxt server routes.
    Then we use $fetch to send server-side for example using our custom composable.

    This was working up until v3.7.0 so I suspect it has something to do with the Nitro 2.6 update.

    import type { H3Event } from 'h3'
    import { getCookie } from 'h3'
    
    const baseUrl = process.env.NUXT_APP_HUB_BASE_URL
    interface INitroApiOptions {
      event: H3Event
      endpoint: string
      action?: string
      requiresAuth?: boolean
      method?: any
      contentType?: string
      query?: any
    }
    
    export default function useNitroApi(options: INitroApiOptions, data?: any): Promise<any> {
      const {
        event,
        endpoint,
        action,
        requiresAuth = false,
        method = 'GET',
        contentType = 'application/json',
        query = {},
      } = options
      const headers: any = {
        Accept: contentType,
        'Language-Locale': getCookie(event, 'i18n_redirected'),
        'Content-Type': contentType,
      }
      if (requiresAuth) {
        headers.Authorization = `Bearer ${getCookie(event, 'token') || ''}`
      }
    
      const opts: any = {
        method,
        headers,
      }
    
      if (!['show', 'index', 'destroy'].includes(<string>action)) {
        opts.body = data ? JSON.stringify(data) : undefined
        opts.query = query
      }
    
      return $fetch(`${baseUrl}${endpoint}`, opts)
    }
  10. productdevbook commented on Oct 26, 2023

    @productdevbook
    Member

    This was working up until v3.7.0 so I suspect it has something to do with the Nitro 2.6 update.

    I also had this error in version 3.7 and I was not interested because I was suspicious of the db. now 3.8 has the same error.

  11. adam-artisan-studio commented on Oct 26, 2023

    @adam-artisan-studio

    @danielroe Could the issue be due to nitro changing to unjs/httpxy?

    This does seem to be around the same date 3.7.0 was released.
    nitrojs/nitro@dd8101f

    Also this does seem to be where the error is coming from 👀
    https://github.com/unjs/httpxy/blob/1f62fffb141e905a398f55eb34bd75366082ca3c/src/middleware/web-incoming.ts#L122

  12. adam-artisan-studio commented on Oct 26, 2023

    @adam-artisan-studio

    This was the issue and I have found a solution which works perfectly 😁
    Try adding this to your nuxt config. On my side there are no more timeouts even after several refreshes!

    nitro: {
      devProxy: {
        host: 'localhost',
      },
    },
  13. 201 remaining items

  14. hellodigua commented on Sep 5, 2025

    @hellodigua

    Still get the issue every few minutes too, really slowing down the dev process仍然每隔几分钟就会出现问题,确实减慢了开发过程

    How can I give access to my repo for reproduction?如何访问我的回购进行复制?

    I upgrade to [email protected] and then solved this problem, your can try it. @jeannen

  15. mananchawla2005 commented on Sep 22, 2025

    @mananchawla2005

    still happening!

  16. AXYZE9 commented on Sep 25, 2025

    @AXYZE9

    If anybody has this issue - I've fixed it by removing HTTP method suffix from filename of problematic file.

    So in my case upload.post.ts -> upload.ts

    If I rename it back then it crashes once again.

    For fun I've asked GPT-5-Codex and Claude 4 Sonnet if that filename difference can cause crashes and both denied such possibility.

  17. martinszeltins commented on Sep 25, 2025

    @martinszeltins
    Contributor

    @mananchawla2005 and @AXYZE9 and @jeannen If you are still experiencing the issue and it is reproducible, could you please submit an Issue and provide a minimal reproduction e.g. with Stackblitz? That would be genuinely useful for all of us. 🙏🏻

  18. mananchawla2005 commented on Sep 25, 2025

    @mananchawla2005

    @martinszeltins Hey martin its very difficult to figure out the root cause of the error as there is literally no error stack for it. The dev server is running just fine and then suddenly out of nowehere

    ℹ Compiled router.options.mjs in 684.99ms                                 nuxt 1:57:19 PM
    [1:57:23 PM] ℹ hmr update /components/PdfViewer.vue, /node_modules/tailwindcss/tailwind.css (x34)
    ℹ Compiled router.options.mjs in 955.86ms                                 nuxt 1:57:25 PM
    [1:58:02 PM] ℹ hmr update /components/PdfViewer.vue, /node_modules/tailwindcss/tailwind.css (x35)
    [nuxt 1:58:04 PM] ℹ Compiled runtime.vue-devtools-client.amgIGTZd1IoaXw9u__viXW6cHThGeffH7XIgdCELkRA.js in 688.57ms
    ℹ Compiled router.options.mjs in 689.5ms                                  nuxt 1:58:04 PM
    ℹ nuxt.config.ts updated. Restarting Nuxt...                                   1:58:25 PM
    ℹ Using default Tailwind CSS file                             nuxt:tailwindcss 1:58:26 PM
    
     WARN  Module pinia is disabled due to incompatibility issues:                  1:58:26 PM
     - [nuxt] Nuxt version ^3.15.0 is required but currently using 4.1.2
    
    ℹ Tiptap Editor initialized                                                    1:58:26 PM
      ➜ DevTools: press Shift + Alt + D in the browser (v2.6.4)                     1:58:26 PM
    
    ℹ Nuxt Icon server bundle mode is set to local                                 1:58:26 PM
    ℹ Using default Tailwind CSS file                                                                           nuxt:tailwindcss 1:58:29 PM
    
     WARN  Module pinia is disabled due to incompatibility issues:                                                                1:58:29 PM  
     - [nuxt] Nuxt version ^3.15.0 is required but currently using 4.1.2
    
    Tiptap Editor initialized
      ➜ DevTools: press Shift + Alt + D in the browser (v2.6.4)                                                                   1:58:29 PM
    
    ℹ Nuxt Icon server bundle mode is set to local                                                                               1:58:30 PM
    ✔ Vite client built in 58ms                                                    1:58:31 PM
    ✔ Vite server built in 68ms                                                    1:58:31 PM
    ✔ Nuxt Nitro server built in 3135ms                                      nitro 1:58:35 PM
    ℹ Vite client warmed up in 4ms                                                 1:58:35 PM
    ℹ .nuxt/dist directory has been removed. Restarting Nuxt...                    1:58:35 PM
    ℹ Vite server warmed up in 25ms                                                1:58:35 PM
    PS C:\Me\Projects\retrack> 

    The server is not only restarting, it is also crashing. If you tell me I can try enabling some options (if any) to get better error stack for it to trace the root cause of it.

  19. mananchawla2005 commented on Sep 25, 2025

    @mananchawla2005

    The nuxt config wasnt updated at all a normal file was

  20. MickL commented on Sep 25, 2025

    @MickL

    Please open a new issue, we all get notifications for this long resolved issue

  21. Nyantekyi commented on Oct 7, 2025

    @Nyantekyi

    Bruh... I still have this issue in dev mode... Please re-open this issue

  22. codeflorist commented on Oct 7, 2025

    @codeflorist

    Instead of crashing, the dev server now restarts in my case, but ends up in a broken state: CSS is suddenly missing on a page-reload and only applied at the end of the request, which seems slower too. And hot-reload is occasionally broken, with components not reflecting current changes even after a page reload. A restart of the dev server fixes the problem.

    Does anyone else experience this?

    I know, this might be a new issue, but the problem is, that this is very hard to debug and create a reproduction of.

  23. Psycarlo commented on Oct 8, 2025

    @Psycarlo

    I am still having this issue.

    "nuxt": "^4.0.3",
     "vue": "^3.5.17"

    with

    "packageManager": "[email protected]",
  24. MickL commented on Oct 8, 2025

    @MickL

    Please open a new issue with reproduction, we all get notifications here. The issue has been solved for a long time

  25. Psycarlo commented on Oct 9, 2025

    @Psycarlo

    Please open a new issue with reproduction, we all get notifications here. The issue has been solved for a long time

    If people are still experiencing the issue, how was it solved for a long time?

    Mute the thread if you don't want to receive notifications...

  26. chrisprobst commented on Oct 10, 2025

    @chrisprobst

    Please open a new issue with reproduction, we all get notifications here. The issue has been solved for a long time

    It's not difficult.

    npm create nuxt@latest # Select deno
    cd <project>
    deno task dev -A

    Navigate chrome to localhost:3000 ... wait for seconds in order for deno to properly crash aaaand:

     ERROR  Child socket connection error: connect ENOENT /var/folders/fd/pttbx7q55wv1r5x5qtw7h2gc0000gn/T/nuxt-dev-4939.sock  
    
    ...
    
    deno(25137,0x20a64c800) malloc: Failed to allocate segment from range group - out of space
    
    ...
    
    Fetch handler error: error sending request for url (http://localhost:3000/): client error (Connect): tcp connect error: Connection refused (os error 61)
    

    It's unusable.

    I can't understand how this is not reproducible all the time? It's the bare minimum and deno and nuxt 4 are just not compatible.

    Let's put it differently: Proof to me that deno and node actually work. Because in no combination I get it to work at all. Not on macOS, not on Ubuntu 24.04.3. Also using latest deno and latest nuxt.

    This is not fixed, it's the same issue.

    To be clear: nuxt dev --no-fork appers to fix it, as worded above and in nuxt/cli#1240. But why? And why is this not well known at deno? This seems to be utterly buggy.

  27. danielroe commented on Oct 10, 2025

    @danielroe
    Member

    @chrisprobst this issue was not about deno. the issue tracking deno support is nuxt/cli#1240.

    I'm going to lock this conversation. ECONNRESET is an error that can be caused by many things. If you are encountering this, please open a new issue with a reproduction. 🙏

  28. locked as resolved and limited conversation to collaborators on Oct 10, 2025
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

    cliupstream🔨 p3-minor

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions