Christopher Dosin

Nuxt.js FATAL ERROR CALL_AND_RETRY_LAST Allocation failed

May 11, 2019

Just a quick tip to help you out, if you’re running into the same issue like me. We’re currently building a pretty big Application based on Nuxt.js During the compiling Nuxt crashed on almost each save with the error message

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

This issue was also mentioned on Github, but without a proper solution.

Solution

So the problem was that Node was running out of memory, to solve the Application from crashing, just incraese the memory limit. Node.js default memory limit is set to 1.7GB, so we increased it to 4GB.

With the parameter --max-old-space-size=4096 you can increase the memory limit for Node.js Just add the above parameter to your dev script in your package.json.

"dev": "cross-env NODE_ENV=development PORT=3333 nodemon --max-old-space-size=4096 server/index.js --watch server",

After we increased the memory limit the application did not crashed anymore.


Christopher Dosin

I am a Fullstack Javascript Developer and a digital nomad trying to build useful things. You should follow me on Twitter