Troubleshoot build errors and crashes (2024)

A reference for troubleshooting build errors and crashes when using EAS Build.

When something goes wrong, it probably will go wrong in one of two following ways:

  1. Your build will fail.
  2. The build will succeed but encounter a runtime error, for example, it crashes or hangs when you run it.

All standard advice around narrowing down the source of an error applies here; this document provides information that may be useful on top of your typical troubleshooting processes and techniques. Troubleshooting is an art, and you might need to think creatively.

Find the related error logs

Before you go further, you need to be sure that you have located the error message and read it. How you do this will be different depending on whether you're investigating a build failure or runtime error.

Runtime errors

Common questions that fall under this category are: "my app runs well locally but crashes immediately when I run a build" or "my app works in Expo Go but hangs on the splash screen in my build". When your app builds successfully but crashes or hangs when you run it, this is considered a runtime error.

Refer to the "Production errors" section of the debugging guide to learn how to locate logs when your release builds are crashing at runtime.

If you can't find any useful information through this approach, try narrowing down the source of the crash step by step.

Build errors

Go to your build details page (find it on the build dashboard if you don't have it open already) and expand any failed build phases by clicking on them. Often, the earliest phase with errors will contain the most useful information and any subsequent failed phase will have cascaded from the first.

Regardless of the phase, it's common to see log entries prefixed with [stderr], but keep in mind that this doesn't necessarily mean those logs point to errors; it's common for CLI tools to use stderr to output warnings and other diagnostics.

For example, you might see something like this on your Android builds:

Terminal

[stderr] Note: /build/workingdir/build/app/node_modules/@react-native-async-storage/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java uses or overrides a deprecated API.

[stderr] Note: Recompile with -Xlint:deprecation for details.

While you may or may not be interested in following up on that warning, it is not the cause of your failed build. So how do you know which logs are truly responsible? If you are building a bare project, you will already be good at this. If you are building a managed project, it may be tricky because you don't directly interact with the native code, only write JavaScript.

A good path forward is to determine if the build failed due to a native or JavaScript error. When your build fails due to a JavaScript build error, you will usually see something like this:

Terminal

❌ Metro encountered an error:

Unable to resolve module ./src/Routes from /Users/expo/workingdir/build/App.js

This particular error means that the app is importing ./src/Routes and it is not found. The cause could be that the filename case is different in Git than the developer's filesystem (for example, routes.js in Git instead of Routes.js), or maybe the project has a build step and it wasn't set up to run on EAS Build. In this case, it turns out that in this case ./src/Routes was intended to import ./src/Routes/index.js, but that path was accidentally excluded in the developer's .gitignore.

It's important to note that with iOS builds the build details page only displays an abridged version of the logs because the full output from xcodebuild can be in the order of 10MB. Sometimes it's necessary to open the full Xcode logs to find the information that you need; for example, if the JavaScript build failed but you don't see any useful information on the build details page. To open the full Xcode logs, scroll to the bottom of the build details page when the build has been completed and either click to view or download them.

If you are working on a managed app and the build error is a native error rather than a JavaScript error, this is likely due to a config plugin or a dependency in your project. Keep an eye out in the logs for any new packages that you have added since your previous successful build. Run npx expo-doctor to determine that the versions of Expo SDK dependencies in your project are compatible with your Expo SDK version.

Armed with your error logs, you can often start to fix your build or search the forums and GitHub issues for related packages to dig deeper. Some common sources of problems are listed below.

Are you using a monorepo?

Monorepos are incredibly useful but they do introduce their own set of problems. It's necessary to upload the entire monorepo to the EAS Build builders, set it up, and run the build.

EAS Build is more like a typical CI service in that we need the source code, rather than a compiled JavaScript bundle and manifest. EAS Build has first-class support for Yarn workspaces, and your success may vary when using other monorepo tools.

For more information, see Working with monorepos.

Out-of-memory (OOM) errors

If your build fails with "Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)" in your Gradle logs, this may be because the Node process responsible for bundling your app JavaScript was killed.

This can often be a sign that your app bundle is extremely large, which will make your overall app binary larger and lead to slow boot up times, especially on low-end Android devices. Sometimes the error can occur when large text files are treated as source code, for example, if you have a JavaScript file that contains a string of 1MB+ of HTML to load into a webview, or a similarly sized JSON file.

To determine how large your bundle is and to see a breakdown of where the size comes from, use react-native-bundle-visualizer.

To increase memory limits on your EAS Build builders, you can use large resource class in your eas.json. See Android-specific resource class and iOS-specific resource class for more information.

None of the files exist error

When you run eas build, your project's files are uploaded to Expo's build servers. However, any file or directory mentioned in the .gitignore is not uploaded. This is intentional to prevent sensitive information, such as API keys, from being exposed in your app's code.

If your project imports a file listed in .gitignore, the build will fail with a None of these files exist error. There are different ways you can resolve this error:

  • Remove the import statement for the ignored file and test your project. If your project functions as expected, that import statement may have been outdated or unused.

  • Remove any files or directories Metro was unable to resolve from your .gitignore. However, this poses a security risk since any sensitive information included in these files will now be available in your project's source code and Git commit history.

  • Encode the file with base64, save that string as secrets, and create the file in an EAS Build hook. See How can I upload files to EAS Build if they are gitignored? for more information.

  • Refactor your source code to avoid importing sensitive files on the client side. If a file is an auto-generated code from a third-party provider and that provider has automatically listed files in your .gitignore, then that file probably contains sensitive information. You should not include it on the client side. During app development, ensure you follow secure practices, such as using environment variables or serving them through your backend. See Using secrets in environment variables for more information.

Verify that your JavaScript bundles locally

When a build fails with Task :app:bundleReleaseJsAndAssets FAILED (Android) or Metro encountered an error (iOS), it means Metro bundler was unable to bundle the app's JavaScript code while trying to embed it in your app's binary. This error message is usually followed by a syntax error or other details about why bundling failed. Unfortunately, a standard React Native project is configured to perform this step late in the Gradle/Xcode build step, meaning it can take a while to see this error.

You can build the production bundle locally by running npx expo export to bypass all of the other build steps so you can see this error much more quickly. Run this command repeatedly, resolving any syntax errors or other issues uncovered until the bundle builds successfully. Then try your EAS Build again.

Verify that your project builds and runs locally

If the logs weren't enough to immediately help you understand and fix the root cause, it's time to try to reproduce the issue locally. If your project builds and runs locally in release mode then it will also build on EAS Build, provided that the following are all true:

  • Relevant Build tool versions (for example, Xcode, Node.js, npm, Yarn) are the same in both environments.
  • Relevant environment variables are the same in both environments.
  • The archive that is uploaded to EAS Build includes the same relevant source files.

You can verify that your project builds on your local machine with the npx expo run:android and npx expo run:ios commands, with variant/configuration flags set to release to most faithfully reproduce what executes on EAS Build. For more information, see Android build process and iOS build process.

Terminal

# Locally compile and run the Android app in release mode

-

npx expo run:android --variant release

# Locally compile and run the iOS app in release mode

-

npx expo run:ios --configuration Release

If use CNG, these commands will run npx expo prebuild to generate native projects to compile them.You likely want to clean up the changes once you are done troubleshooting, unless you want to start managing these projects directly instead of generating them on demand.


You can alternatively run a local build with eas build --local — this command will run aseries of steps that is as close as it can be to what runs remotely on the hosted EAS Buildservice. It will copy your project to a temporary directory and make any necessary changes there.Learn how to set this up and use it fordebugging.

If your native toolchains are installed correctly and you are unable to build and run your project in release mode on your local machine, it will not build on EAS Build. Fix the issues locally, then try again on EAS Build. The other advice in this doc may be useful to help you resolve the issue locally, but often this requires some knowledge of native tooling or judicious application of Google, Stack Overflow, and GitHub Issues.

Don't have Xcode and Android Studio set up on your machine?

If you do not have native toolchains installed locally, for example, because you do not have an Apple computer and therefore cannot build an iOS app on your machine, it can be trickier to get to the bottom of build errors. The feedback loop of making small changes locally and then seeing the result on EAS Build is slower than doing the same steps locally because the EAS Build builder must set up its environment, download your project, and install dependencies before starting the build.

If you are willing and able to set up the appropriate native tools, then refer to the React Native environment setup guide.

My app builds locally, but not on EAS Build

By default, EAS Build follows a relatively straightforward process for building your app for (Android or iOS). If npx expo run:android --variant release and npx expo run:ios --configuration Release work locally, but your builds fail, then it's time to narrow down what configuration exists on your machine that hasn't been set up for your project on EAS Build yet.

  • Do a fresh git clone of your project to a new directory and get it running, ideally on a different machine. Pay attention to each of the steps that are needed and verify that they are also configured for EAS Build.
  • Check that your environment variables are properly configured.
  • Verify that versions of Node.js, npm, Yarn, Xcode, Java, and other tools are the same in both environments.
  • Ensure that the archive you are uploading to EAS Build includes the same relevant source files.
Why does my production app not match my development app?

You can test how the JS part of your app will run in production by starting it with npx expo start --no-dev. This tells the bundler to minify JavaScript before serving it, most notably stripping code protected by the __DEV__ boolean. This will remove most of the logging, HMR, Fast Refresh functionality, and make debugging a bit harder, but you can iterate on the production bundle faster this way.

Still having trouble?

This guide is far from being comprehensive, and depending on your level of experience you might still be struggling to get your app working.

If you have followed the advice here, you're now in a good position to describe your issue to other developers and get some help.

How to ask a good question

Join us on Discord and Forums to ask for help from the community and the Expo team. The Expo team does our best to respond to high quality and well-articulated questions and issues, but responses are not guaranteed unless you are signed up for a support plan. To ensure that an Expo team member sees your question, you can file a ticket at expo.dev/contact.

When you ask for troubleshooting help, be sure to share the following information:

  • A link to your build page. This can only be accessed by your team or Expo employees. If you'd like to share it more publicly, take a screenshot. If you'd like to share it more privately, send an email to secure@expo.dev and mention that in your help request on chat or forums. If you are performing this build locally with eas build --local, you may omit this, but please indicate this fact.
  • Error logs. Anything that you suspect may be related to your build or runtime error. If you can't provide this, please explain why not.
  • Minimal reproducible example or a link to your repository. The quickest way to get a solution to your problem is to ensure that other developers can reproduce it. If you have ever worked on a team, you know this from experience. In many cases, if you can't provide a reproducible example then it may not be possible to help you, and at best the back-and-forth process of asking and answering questions will be an inefficient use of time. Learn more about how to create a reproducible example in the manual debugging guide and Stack Overflow's Minimal Viable Reproducible Example guide.

Try to be clear, precise, and helpful. General guidance provided by Stack Overflow's How to ask a good question guide applies.

Troubleshoot build errors and crashes (2024)

FAQs

How to resolve build error? ›

To fix this error you can import the offending component, provider, pipe or directive into the app. module file and then if it is a provider add it to the providers array and for a component, pipe or directive add it to both the declarations array and entryComponents array.

How do I fix build errors in Visual Studio Code? ›

Press Ctrl+G to quickly jump to the line number where the error occurred. Visual Studio identifies this error with a red "squiggle" underscore. Hover over it for more details. Make the fix and it goes away, although you might introduce a new error with the correction.

How do you troubleshoot a system crash? ›

The next step in troubleshooting a system crash is to perform a basic check of your system and eliminate any common causes. This includes scanning for viruses and malware, updating your OS and drivers, checking disk space and memory, verifying hardware and connections, and assessing the power supply and battery.

How to check why build failed? ›

Try checking for differences in the build settings or committed code between branches. Also, if the build starts failing consistently after a certain commit on the same branch, it's worth checking what changes were made in the failing commit.

What does build error mean? ›

In software terms it means that there is currently an error in the project code that is preventing it from compiling and running properly.

What is the best way to eliminate an error? ›

5 ways to eliminate errors that wreck your results
  1. What would you do differently next time? It's a simple question to ask, but you'll be surprised at the answers you'll get. ...
  2. Ensure they're actionable. ...
  3. Communicate them to the right people. ...
  4. Make someone accountable for using each lesson. ...
  5. Conduct after-action reports.
Feb 22, 2017

How do I clean build code in Visual Studio? ›

On the menu bar, choose Build, and then choose either Build ProjectName or Rebuild ProjectName.
  1. Choose Build ProjectName to build only those project components that have changed since the most recent build.
  2. Choose Rebuild ProjectName to "clean" the project and then build the project files and all project components.
Oct 17, 2023

How do I see all build errors in Visual Studio? ›

To display the Error List, choose View > Error List, or press Ctrl+\+E.

Why did build fail in Visual Studio? ›

Common Causes of "Build Failed but No Errors" Issue:

Third-Party Tools or Extensions: Incompatibilities or conflicts with third-party tools or extensions installed in Visual Studio can disrupt the build process, causing failures without clear indications of the cause.

How do you fix or troubleshoot a crashing application? ›

  1. 1 Check for error messages. ...
  2. 2 Restart the software or device. ...
  3. 3 Update the software and drivers. ...
  4. 4 Scan for malware and viruses. ...
  5. 5 Uninstall or reinstall the software. ...
  6. 6 Contact technical support. ...
  7. 7 Here's what else to consider.
Dec 17, 2023

How do I clear troubleshoot problems? ›

Troubleshooting steps
  1. Step 1: Define the problem. The first step of solving any problem is to know what type of problem it is and define it well. ...
  2. Step 2: Collect relevant information. ...
  3. Step 3: Analyze collected data. ...
  4. Step 4: Propose a solution and test it. ...
  5. Step 5: Implement the solution.
Apr 11, 2024

How do you resolve build failure? ›

  1. Review the build logs: The first step is to review the build logs to identify where the build process failed. ...
  2. Reproduce the issue locally: Try to reproduce the issue locally in a development environment. ...
  3. Check for configuration errors: Check the pipeline configuration files to ensure that they are correct and complete.
Mar 15, 2023

What causes build failure? ›

Automated dependency update: Outdated dependencies are one of the causes of build failure. To avoid this, updating dependency versions would help you avoid causing changes that could cause build failures. To this, you should have your dependency versions updated automatedly.

What does build failing mean? ›

A failed build means the code cannot be compiled => there is nothing to run. Or maybe there is a previous successful build and there is something to run and debug but it is not the current code. You don't want to continue, you have to fix the errors first.

What is error obtaining a build status? ›

The "Error obtaining a build status" error indicates that something went wrong in the process of generating a report. However, it is not possible to determine the cause of this issue without reviewing details of the exception that is thrown on your web server.

What is a build time error? ›

As the name implies, compile time errors occur when the code is built, but the program fails to compile. In contrast, Java runtime errors occur when a program successfully compiles but fails to execute. If code doesn't compile, the program is entirely unable to execute.

What is a build problem? ›

test failure — a failure of a unit or functional test that was attempted during a build. build problem — any other issue that occurred during a build: inability to access a remote repository, failure to obtain or upload a build artifact, compilation error, and so on.

How do I resolve HTTP errors? ›

The possible fixes for this issue are:
  1. Refreshing the page.
  2. Clearing the browser cache and cookies.
  3. Loading the page with a different network.
  4. Resetting permissions for files and folders.
  5. Updating the PHP version.
  6. Regenerating the . htaccess file or correcting errors in the . ...
  7. Disabling the third-party plugins.
Nov 30, 2022

References

Top Articles
Latest Posts
Article information

Author: Eusebia Nader

Last Updated:

Views: 6199

Rating: 5 / 5 (60 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Eusebia Nader

Birthday: 1994-11-11

Address: Apt. 721 977 Ebert Meadows, Jereville, GA 73618-6603

Phone: +2316203969400

Job: International Farming Consultant

Hobby: Reading, Photography, Shooting, Singing, Magic, Kayaking, Mushroom hunting

Introduction: My name is Eusebia Nader, I am a encouraging, brainy, lively, nice, famous, healthy, clever person who loves writing and wants to share my knowledge and understanding with you.