Lately, my development server in Gatsby.js repeatedly crashed:

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

I found a similar issue on GitHub. Suggested fixes: updating Gatsby and especially updating netlify-cms-app.

My problem: All my dependencies were up to date, and I didn’t have netlify-cms-app, gatsy-plugin-netlify-cms, or similar installed.

Solution (GitHub):
add NODE_OPTIONS = "--max_old_space_size=4096 to node.js.

You can set a universal variable in Fish shell:

set -U NODE_OPTIONS --max-old-space-size=4096

If you don’t want to set an environment variable, you can pass NODE_OPTIONS as a flag to your npm command:

npm run start --node-flags --max-old-space-size=4096--no-warnings

Further Reading