nuxt: ERROR [unhandledRejection] read ECONNRESET
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: pnpm@8.9.2
- Builder: -
- User Config: app, devtools, modules, css, ui, colorMode, postcss
- Runtime Modules: @nuxt/ui@2.9.0, @nuxt/image@1.0.0-rc.3
- 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)
About this issue
- Original URL
- State: open
- Created 8 months ago
- Comments: 62 (9 by maintainers)
@danielroe I created a reproduction repo at this url:
https://github.com/JulienChampagnol/ReproduceNuxtElectronError/tree/main
Couldn’t make it to work on stackblitz, probably because of the electron window and security concerns I suppose. Hope this helps!
Same here
I can confirm this is happening to me as well, Node v20 and Nuxt v3.10.0
@danielroe Any news about this?
@danielroe could we just have an update, will you or anyone from the core team look at this anytime soon or should the community find a workaround on their own? Thanks for your answer.
Once again, I did a super simple project a few months ago (and linked issue)without any customizations or plugins. Just nuxt, vue and vue-router (installed by default). The only thing there is 3998 super simple components. that output a string and add count to the console. 100% error ERROR [unhandledRejection] in npm run dev
why is this issue closed if this problem is still relevant? just upgraded my project to the latest version with node 20.10 and facing the same issue
@Flashantik it seems like it might be a related issue, but (at least for me) I’m not experiencing any slowdown rendering anything. I get this error pretty much 100% of the time when running dev mode. Sometimes immediately, sometimes after a couple of minutes. It seems to possibly be triggered by saving files/hot reloads, but I can’t find any consistent pattern.
Edit: and the error is just the last part of the logs, like @Hibrix-net just posted
I’m able to develop for a little bit (usually only a minute or two), but at some point I’ll save a file, trigger a hot reload, and then I get this error:
same,I get problem every time when i refresh browser, 100% reproducible
cc: @pi0
Yes, HMR never works for me due to this error. I always refresh manually during development.
I’m also still waiting for any news. Issue is still there 😬
I have the same issue upgrading
nuxtfrom3.10.3 -> 3.11.1as @realityfilter commented, I downgraded mynitropackto2.8.1it’s solved my problem.Version & Config
node:v18.19.1nuxt:3.11.1pnpm:8.15.5ssr: falsepackage.jsonThanks for carving time to reproduce this @JulienChampagnol! 🎖️ More of a note, we’re not using
nuxt-electronand yet we can still reproduce the issue. Based on previous answers, I believe others also have different setups that don’t necessarily overlap with Electron, making it seem like a base Nuxt thing.When researching about it, there seem to be a lot of somewhat related issues: https://github.com/nuxt/nuxt/issues/24355 https://github.com/nuxt/nuxt/issues/25115 https://github.com/nuxt/nuxt/issues/26396 https://github.com/nuxt/image/issues/1158 https://github.com/nuxt/cli/issues/335 https://github.com/nuxt/cli/issues/338 https://github.com/nuxt/cli/issues/346 https://github.com/caoxiemeihao/nuxt-electron/issues/71
same, why is this issue closed when no permanent and universal solution is provided?
I have the same problem
This does not solve my problem
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
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 issuesI 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
Same here
Yes, this isn’t related with
nuxt-electronit is a generic Nuxt issue.I’ve tried updating Nitro and Nuxt versions as shared above but no solution worked, and this is affecting our entire team which also indicates it’s not a local config thing.
Running localhost in debug mode doesn’t raise anything fishy, yet the server breaks on the very first hot reload (also, client-only change).
I’m not sure what else to try in this case 🤔
https://github.com/nuxt/nuxt/issues/25115 also seems related.
Do you have any plugins that may be setting that? In my case,
nuxt-electronis setting it.Same here. Mac with node latest v18 and v20. The only workaround I found working is downgrading nitropack to v2.8.1. Thanks for the hint.
as I already described this in another issue (https://github.com/nuxt/cli/issues/335), it is unlikely that the problem is only in nitro, since if you install nuxt@3.6.5 the nitro version remains fresh Nitro@2.8.1 however the problem goes away. Could there be a problem with the way nuxt interacts with nitro?
I have the same issue.
Following error after making changes in dev (yesterday):
Today again:
How i run the project?
HOST=0 NODE_TLS_REJECT_UNAUTHORIZED=0 nuxt devThis does not solve my problem
@Hibrix-net @max-lf I was able to reproduce the error on a simple application, it seems the problem is the number of requests. nuxt@3.6.5 works fine. https://github.com/nuxt/cli/issues/335
Are you having the same problem?
This seems to have solved it for me. Thank you very much!
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!
@bitsnaps That’s not valid code on the server. Wrap it in
if (import.meta.client)or check withtypeof Stripeor accessglobalThis.Stripe.It’s been months that I’m asking myself the exact same thing… (they blame Nitro btw)
I do not have a app.buildAssetsDir set. So in my case this is not the culprit.
In that case it is an issue either in nuxt/cli or in how the cli interacts with nitro.
cc: @pi0
Not sure why they seem to ignore this issue…
I found that this error occurs when developing in a devcontainer.
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.
@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
useAsyncDatacatchall 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.
@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.
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.