a month ago
I am consistently hitting an Out-Of-Memory (OOM) error during the npm ci phase of my deployment for my project, CLVRQuantAI. Despite implementing standard optimizations—including a clean .dockerignore, separated build phases, and avoiding unnecessary npm audits—the build environment is unable to process my dependency tree.
Project Details:
Dependency Count: 90+ direct packages.
Memory-Intensive Packages: googleapis, @solana/web3.js, sharp, and full Radix UI suite.
Current Error: npm error Exit handler never called! and process termination during dependency installation.
Actions Taken:
Verified .dockerignore excludes all unnecessary files.
Separated build phases to isolate heavy processes.
Attempted various npm flag combinations (--prefer-offline, --no-audit, --no-fund).
The Ask:
Since I have exhausted local optimization strategies, could you please advise if there is a way to increase the build container memory limit for my account, or if there is a recommended "best practice" for deploying projects with this specific dependency footprint on Railway? If an increase is not possible, could you confirm if I should transition to a pre-built Docker image workflow via a CI/CD pipeline (e.g., GitHub Actions) to bypass the Railway builder?
6 Replies
I am a bit annoyed I pay more money to get costumer support but still nothing…
a month ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 28 days ago
a month ago
with 90+ deps including solana/web3.js and sharp, npm ci is just too heavy for railway's default build memory. a few things that actually help:
switch to pnpm instead of npm ci — it's way more memory efficient during installs
or add this to your nixpacks.toml:
[variables]
NODE_OPTIONS = "--max-old-space-size=4096"
if neither works, yeah your best bet is a pre-built docker image. build locally or in github actions, push to ghcr.io, then deploy the image on railway instead of letting it build from source
itztrmin
with 90+ deps including solana/web3.js and sharp, npm ci is just too heavy for railway's default build memory. a few things that actually help: switch to pnpm instead of npm ci — it's way more memory efficient during installs or add this to your nixpacks.toml: [variables] NODE_OPTIONS = "--max-old-space-size=4096" if neither works, yeah your best bet is a pre-built docker image. build locally or in github actions, push to ghcr.io, then deploy the image on railway instead of letting it build from source
a month ago
Nixpacks is deprecated, NODE_OPTIONS = "--max-old-space-size=4096" should be add as a service env var instead.
a month ago
1.GitHub Actions runner builds the image.
2.npm ci runs in GitHub Actions (which typically has more available memory).
3.Docker image is pushed to a registry such as:
GitHub Container Registry
Docker Hub4.Railway deploys the already-built image.