Problem installing location module, how to link modules with Expo managed workflow?

  1. SDK Version: 4.7.3
  2. Platforms(Android/iOS/web/all): React Native (so far just Android)
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I’m developing a sports app with React Native / Expo which needs to track user background when the app is in the background.

This is related to my previous question (React Native expo-location: How to make the background location service update more often?). I came to the conclusion that the background location tracking in the ‘expo-location’ package does not seem to sufficiently work, so I started building a new solution based on the package ‘@mauron85/react-native-background-geolocation’ which I found was recommended in several tutorials.

So I installed the module and built my map component based on the example code provided in the documentation (GitHub - mauron85/react-native-background-geolocation: Background and foreground geolocation plugin for React Native. Tracks user when app is running in background.).

However, when running the app on Expo Go, I get the following error message despite doing all the required imports:

Component Exception: RNBackgroundGeolocation is undefined

This appears to be caused by a problem in linking modules, which I failed to do during the installation. The component requires to do linking of modules with the following command:

node ./node_modules/@mauron85/react-native-background-geolocation/scripts/postlink.js

Because I use Expo managed workflow, I lack the folder structure (./android/settings.gradle etc) required by this script and receive an error of ‘android/settings.gradle not found’. Based on some searching, this seems to require running ‘expo eject’ on the whole project so that I can do configurations in the platform-specific folders.

However, ‘expo eject’ runs into errors in the “Installing JavaScript dependencies” phase and just returns an error of “Something went wrong … …”, and the error logs provide no further clarification.


  1. How to get forward when something goes wrong in the ‘expo eject’ phase like this? The error logs get really messy and unclear.
  2. I would really prefer to stay in the managed workflow to avoid any mess. Is there a way to get the modules linking work within the Expo managed workflow?

Any help appreciated, thanks.

Hi @ajupar

The preferred way to add native code to Expo these days is by using EAS Build. If the module needs something extra (which this one seems it might) then you should create a Config Plugin to handle that during the build process.

For development you should build a Custom Development Client and use that instead of Expo Go.

See the Expo SDK 42 release notes and other recent posts on and also the Feature Preview section of the Expo docs.

1 Like

Hello @wodin ,

Kind thanks for your reply!

I will look into using EAS Build, Custom Development Client and creating a Config Plugin. It appears that I will need to somehow convert the original “postlink.js” script into a config plugin.

I only first started doing mobile development in April (this year, 3 months ago) and I have overall only about two years of programming experience (mostly Java). It’s quite likely that using EAS Build, Custom Development Clients and Config Plugins will go a bit too much over my current skill level, but I will give it some try.

My current project is a practice project where I try to do one of my first functioning mobile applications. For the current situation it might be best to be content with a functioning foreground location service (I got it working!) and do the rest of the minimum functions of the app before getting back to this tricky background location problem. Because, somehow, I have a smell that this could be a never-ending time consumer in my project if I really start delving into it!

Big thanks for your reply anyway, and it gave me directions where to start looking next when I get back to the problem!

1 Like

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