![]() |
| How to fix error FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory NuxtJS |
For everyone who faces this problem. Try to bump the memory limit with max-old-space-size the node optimization flag, but use it correctly. As example:
"scripts": {
"dev": "node --max-old-space-size=4096 node_modules/nuxt/bin/nuxt.js",
"build": "node --max-old-space-size=4096 node_modules/nuxt/bin/nuxt.js build",
"start": "node --max-old-space-size=4096 node_modules/nuxt/bin/nuxt.js start"
}An example for TS guys:
"scripts": {
"dev": "node --max-old-space-size=4096 node_modules/@nuxt/typescript-runtime/bin/nuxt-ts.js",
"build": "node --max-old-space-size=4096 node_modules/@nuxt/typescript-runtime/bin/nuxt-ts.js build",
"start": "node --max-old-space-size=4096 node_modules/@nuxt/typescript-runtime/bin/nuxt-ts.js start"
}If you still get errors, allocate some more memory--max-old-space-size=8192, etc.
If you don't have enough memory on the node, try to add a flag --optimize_for_size, this will allow less memory to be allocated but may affect performance and give some errors in theory.
Source: https://github.com/nuxt/nuxt.js/issues/5396#issuecomment-671779648

0 nhận xét: