Receiving "JavaScript heap out of memory" when nitro is building. The application built perviously.

Was there a recent update to nuxt or nitro or a dependency that can cause this. The application was building properly before, this issue was observed as of two days ago. The entire error is in the attachment. <--- Last few GCs ---> [51779:0x150008000] 263322 ms: Mark-Compact 4014.1 (4129.9) -> 4010.2 (4143.6) MB, 3616.92 / 0.00 ms (average mu = 0.680, current mu = 0.209) allocation failure; scavenge might not succeed [51779:0x150008000] 272034 ms: Mark-Compact 4026.2 (4143.9) -> 4015.6 (4145.4) MB, 8652.25 / 0.00 ms (average mu = 0.284, current mu = 0.007) allocation failure; scavenge might not succeed <--- JS stacktrace ---> FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory ----- Native stack trace -----
6 Replies
Cesar
Cesar8mo ago
Same problem here durint deployment with the latest nuxt version
whoisthiru
whoisthiru8mo ago
I use NODE_OPTIONS=--max_old_space_size=8192 to increase the heap memory, when running, nuxt build, nuxt generate, nuxt dev Here is my package.json depicting this.
"scripts": {
"build": "NODE_OPTIONS=--max_old_space_size=8192 nuxt build",
"dev": "NODE_OPTIONS=--max_old_space_size=8192 nuxt dev --host",
"test": "vitest",
"generate": "NODE_OPTIONS=--max_old_space_size=8192 nuxt generate",
"scripts": {
"build": "NODE_OPTIONS=--max_old_space_size=8192 nuxt build",
"dev": "NODE_OPTIONS=--max_old_space_size=8192 nuxt dev --host",
"test": "vitest",
"generate": "NODE_OPTIONS=--max_old_space_size=8192 nuxt generate",
SharpieMaster
SharpieMaster4mo ago
Are you sure thats right?
> dev
> NODE_OPTIONS=--max_old_space_size=8192 nuxt dev --host

'NODE_OPTIONS' is not recognized as an internal or external command,
operable program or batch file.
> dev
> NODE_OPTIONS=--max_old_space_size=8192 nuxt dev --host

'NODE_OPTIONS' is not recognized as an internal or external command,
operable program or batch file.
whoisthiru
whoisthiru4mo ago
You have to update your package.json file’s scripts section with the dev command I’ve shared. Then execute npm run dev from command line.
SharpieMaster
SharpieMaster4mo ago
That is what I did, and that is what shows up Should this be in a git bash command line?
Cue
Cue4mo ago
Use cross-env if you're not on a unix based system Or set NODE_OPTIONS=... <command> if you're on Windows
Want results from more Discord servers?
Add your server