titletext | description |
---|---|
Troubleshoot the most common React Native build errors |
Tips and tricks for troubleshooting the most common causes of React Native mobile app build failures.
|
We’ve put together a quick checklist to help teams troubleshoot the most common causes for build failures.
Here’s what you can to do quickly diagnose and likely resolve build errors:
See Troubleshooting Errors for coverage of specific errors.
It’s important to make sure there are no discrepancies between your remote branch and local git state.
Buddybuild creates a fresh clone of your code and executes build commands on every commit.
Here’s how to replicate this process and ensure your remote branch is up to date:
-
Clone your repo into a new location / folder on your machine
-
Make sure that the node version installed on your machine is what’s being used on buddybuild
-
Do a fresh npm install and attempt to build your app
-
Make sure that the node version you are using locally is the same as what’s being used to build the branch you’re having issues with.
-
A frequently seen issue is a
package.json
that specifies non-explicit versions of package dependencies (i.e. using carets^
and tildes~
). This might result in failed builds because different versions of dependencies are being installed on buddybuild than what is being used on your local machine. Our recommendation is to either remove these characters or to move to using yarn, which has a corresponding yarn.lock that specifies the exact versions you’re using locally.
An offline bundle is required for CI systems to pack the relevant Javascript code into your app, as there’s no development server around to share javascript code.
If your React Native app crashes on launch, and the buddybuild SDK has not been installed, it may not be obvious where to start looking to diagnose the problem.
The most common cause of this issue is a missing main.jsbundle
file.
Local builds appear to work because the file is available. When the file
is missing from your repository, buddybuild can successfully build your
React Native app but the app crashes on launch.
To confirm the exact cause of a crash on launch, examination of the device’s logs is necessary. If the buddybuild SDK has been installed, you can check the dashboard for a crash report. Otherwise, see getting device logs from Xcode.
Unable to resolve module <module name> from <path>: Module does not exist in the module map or in these directories:
We’ve found that this error is generally caused by using wildcards (^
or
~
) in your package.json
.
Our recommendation is to either remove the wildcards, or to move to using yarn and committing your yarn.lock.
This indicates that your app is not correctly configured to generate offline bundles, which is required for apps generated using continuous integration systems like buddybuild.
Look to Make sure your app is configured to generate an offline bundle as to how to configure your app to resolve this.
This generally indicates that you are using a buddybuild-generated scheme
that is not correctly adding libReact.a
as a target dependency.
In these instances, we recommend that you share your scheme and configure your app to use your shared scheme rather than buddybuild’s generated scheme. See Missing schemes for details.
This is generally a result of an incorrectly configured repository with regards to the location of FBSDK dependencies.
If you take a look at: https://github.com/facebook/react-native-fbsdk/blob/master/ios/RCTFBSDK.xcodeproj/project.pbxproj
You will notice that RCTFBSDK will look for dependencies in one of two locations:
-
~/Documents/FacebookSDK
-
$(PROJECT_DIR)/../../../ios/Frameworks
The second option is the correct option for continuous integration systems like buddybuild.
In other words, you MUST place your FBSDK dependencies under the
ios/Frameworks
folder in order for it to work on a continuous
integration system.
/node_modules/react-native-root-siblings/lib/AppRegistryInjection.js: Module does not exist in the module map
This error indicate that there is an incompatibility between one of your
dependencies and the version of React Native set in your package.json
file. For this specific error, react-native
version 0.48 (or higher)
is required.