React Native Troubleshooting

A non-extensive list of common errors and quickfixes for beginners and not so beginners

Jesús Darío
4 min readAug 2, 2017

Module naming collision

Loading dependency graph…jest-haste-map: @providesModule naming collision: Duplicate module name: <npm module name>

Reinstall all packages, and make sure you are not loading any cached modules or your packager has still some in its own caché.

This was so common working on a team when new deps were added or React Native was upgraded that I directly created the script above.

Can’t find some Native Module

Many times it would be because:

a) Linking has not been completed, in which case you need to do it manually or react-native link your-native-module

b) You are misssing some packages after a git pull or a git clone in which case it would be nice that you repeat the script above or reinstall packages

Error calling AppRegistry.runApplication

Many times, you’d have your bridge disconnected. Run:

adb reverse tcp:8081 tcp:8081

Other times, your app may not have compiled properly or your process name mismatches your app name. The script above may help for the first case.

XCode Crashing When Opening Project File

This might be for different reasons. Be aware of possible merge commit errors. The main resources I found to deal with those were basically captured in the following questions:

This was a painfully manual process in both cases. You can try also with some of the most common fixes also:

rm -rf ~/Library/Developer/Xcode/DerivedData

rm ios/YourApp.xcodeproj/project.xcworkspace/xcuserdata/<YourUserName>.xcuserdatad/*”

Can’t debug on my Android

Assuming you have all drivers installed and everything is configured correctly (in Mac OS this is basically out of the box) make sure you are in development mode, if the problem persists restart your phone. If the problem persists restart your computer.

Packager isn’t running… but it is

Specially on iphone, you need to be in the same WiFi network for the websockets to work properly. This won’t happen on a simulator.

Xcode does not find my iphone

This might be caused by using a not standard or protocol complaint cable. It is a very frustating error, that many iOS developers might be unaware with.

Tip: Restart android app from command line

adb shell am force-stop com.company.app && adb shell am start -n com.company.app/com.company.app.MainActivity

Can’t receive notifications on iOS simulator

They simply won’t. You need a real device.

Can’t build on Android

* What went wrong:
A problem occurred configuring project ‘:app’.
> Could not resolve all dependencies for configuration ‘:app:_debugApk’.
> Configuration with name ‘default’ not found.

Normally this occurs when gradle can’t find a dep specified in your settings.gradle. To find out which one is it you can do as specified and run ./gradlew clean — info. It will be a quick run to show which dep is failing to load. Happened in my projects many times, with SVG or Lottie being among the most frequent.

Can’t launch app on iOS simulator

If you see the following error:

Build operation failed without specifying any errors. Individual build tasks may have failed for unknown reasons.
One possible cause is if there are too many (possibly zombie) processes; in this case, rebooting may fix the problem.
Some individual build task failures (up to 12) may be listed below.

You may want to launch another instance of the simulator, change the model. If that doesn’t work, check above for XCode Crashing When Opening Project File. It may help as well.

Compilation failed, duplicated symbols

When migrating a react-native application with manual linking to pods, this error appears during the linking phase. Be wary to duplicate frameworks or libraries that you already have in your Podfile.

Build operation failed without specifying any errors

This is one of my personal favourites

So far I tried several combination of fixes. I assume not always the same reason is the root of the problem. This last time it worked applying this: https://stackoverflow.com/questions/41239452/build-operation-failed-without-specifying-any-errors-for-react-native-xcode-proj

We’d only need to

rm -rf node_modules && yarn

To reset Xcode in the end.

Sometimes I also remove Derived Data, but I don’t know if this is related to the main reason, so abstain of doing so unless you are iterating looking for a solution.

Strict mode does not allow function declarations in a nested statement

Only apparently in Android when building from certain Linux systems (Fedora, CentOS, reported particularly on a Linux Mint machine). Here other references from stackoverflow.

People in the team confirm that this might be due to not having installed the appropriate building tools, and lacking certain building tools. In particular as internals:

sudo apt-get install lib32z1

Even though building JavaScript seems uncorrelated with native build problems, I found this problem quite particular, and felt that it needed to be documented.

This is a living document and will be updated as I find new problems in my day to day development, that have a more or less straightforward solution. Hope it helps so far.

--

--