FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

  • Whether you are bare or managed workflow
    Managed

  • Your eas-cli version
    eas-cli/3.8.1

  • What you have tried so far
    No solution is available online

Fail build
Build failed: The “Run fastlane” step failed with an unknown error. Refer to “Xcode Logs” below for additional, more detailed logs.

In XCode logs, I see the below error -
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

Please help me in fixing this. Any help will be much appreciated.

Using expo ~46.0.19 in the project.

Hi @zuppler-dev

You could try setting Nodejs’ max_old_space_size option.

You can do this using the NODE_OPTIONS environment variable.

I haven’t tried this myself, but this should do it:

eas.json:

{
  "build": {
    "production": {
      "env": {
        "NODE_OPTIONS": "--max-old-space-size=1536"
      }
    }
  }
}

I think I should have mentioned that I am creating the builds online. Builds are being successfully created locally on both platforms but only iOS is getting failed on the expo server.

The command I am using - eas build -p ios -e production



Yes, if you add the environment variable to your “production” profile in eas.json then any node process that runs as part of the build should pick it up. I’m not sure if it will fix your problem, but I think it should. But you might have to try a higher number if 1536 still doesn’t work.

1 Like

Thanks a lot, man! Build was successful this time after increasing the space size to 2500.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.