If you’re a first time contributor, you may face some issues while setting up a local build of the layer5io/layer5 repository.
I faced some challenges myself, so I’m writing to a post to share what I’ve learnt.
I’m running Ubuntu 24.04 with 16GB RAM, and the build is running directly on my OS (not virtualized).
Before moving forward, let’s review the setup commands:
make setup
- this command installs all the necessary dependencies from Layer5make site
- this starts a local development server with hot-reloading, GraphQL debugging, and automatic rebuilds for live testing.
What’s happening?
When you run make site
, the build process often runs out of heap memory, leading to either a process kill or a complete crash.
The terminal output for the same is:
success Building development bundle - 32.041s
success onPreExtractQueries - 0.004s
success extract queries from components - 1.415s
success write out requires - 0.006s
success Re-building development bundle - 2.497s
Killed
make: *** [Makefile:26: site] Error 137
You may also notice your machine suddenly turning slow or unresponsive.
Solution
One way to mitigate this issue is to use the NODE_OPTIONS
command, and manually allocate some RAM to the process. Example,
NODE_OPTIONS="--max-old-space-size=<RAM-in-MB>" npx gatsby develop
NODE_OPTIONS="--max-old-space-size=8192" make site
This prevents crashes by ensuring Node.js has enough memory during the build.
Disabling auto-save on your code editor, and saving only after making the necessary changes is also one way to avoid system crashes.
Has anyone else faced this issue? This is one way to fix to the ran out of memory
problem.
I hope this helped