Empty Nuxt 3 project seems to leak memory locally only in dev mode after second launch
If I run
npx nuxi@latest init MyProject
then
npm run dev
close the process
and repeat npm run dev
(also applies to all further runs)
I observe that the process gains about 4mb of memory usage ever second, it gets up to about 8 gigabytes if I just leave it for a while. I'm on windows 10.
this doesn't happen if I do npm run build
and launch the build file
6 Replies
Hi @Tater. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the knowledge sources provided, this issue appears to be a known problem with Nuxt 3 in development mode. Here's what we know:
1. The memory leak you're experiencing is likely related to an upstream issue with libuv (bundled in Node.js) that affects Nuxt 3 versions higher than 3.14.
2. This problem has been observed and reported by other users, with similar symptoms of persistent CPU and memory usage growth in development mode.
3. The issue doesn't occur in production builds, which aligns with your observation that it doesn't happen when you run
npm run build
and launch the built file.
A possible workaround for this issue is to disable the Nuxt DevTools. As mentioned by a Nuxt team member in this GitHub issue comment, "You can try disabling devtools as a workaround."
To disable DevTools, you can add the following to your nuxt.config.ts
file:
It's worth noting that this issue is expected to be resolved in future versions of Node.js, as the underlying problem has been fixed in libuv. However, it may take some time for the patch to be incorporated into Node.js releases.
If disabling DevTools doesn't resolve the issue or if you need further assistance, you may want to report this problem on the Nuxt GitHub repository with detailed information about your setup and reproduction steps.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@134472133622366208> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
the bot comment seems to resolve this, thanks 😄
anyone know when I should expect this to be fixed? Do I need to update node to fix it?
GitHub
fix: devtools is causing a severe memory leak · Issue #761 · nuxt/d...
🐛 The bug Creating a bare Nuxt project with npx nuxi@latest init project and starting it with npm run dev causes severe memory leak (most of the time). This happens on Windows with Node v22+. This ...
Hard to tell when node ships the new libuv
ok thanks