Trying to use Expo in a monorepo


I’m trying to setup a project with Expo. I’ve tried both the Expo XDE and create-react-native-app but I always end up with the same error.

What I’m trying to do is to create the project in a folder src/js/src/mobile/<project files go here>, but then I want to run it from the root of my project.
I’ve tried putting the main key in my package.json to point to src/js/src/mobile/App.js (main.js when using Expo XDE) and moving app.json (or exp.json) to the root, configuring it to have the entryPoint set to this same file and setting up all the proper babel presets.

The error I get is always the same

Unhandled JS Exception: TypeError

global code


Why do you want to run it from the root of your project? So you can include files under src/ but not under src/mobile/ or some other reason?


Where I work we have a monorepo where the tooling depends on running commands from the root. We only have a single package.json with all of our dependencies and then tooling to allow us to only install packages/run dev environment/run test/etc for a specified project.


Could you write a simple bash script in your root directory that just cd’s into your project subdirectory and runs exp?


I think you could probably hack something together using some of these options:

and maybe something else and maybe a couple lines of a bash script or something like that.

I don’t have a specific concrete solution for your specific case but try looking at those docs, and I think you’ll be able to get something together that works eventually.


Yeah, I could write a bash script, but I’d rather use what we already have since we have a lot of dependencies around only having a single package.json. It runs like this, there’s just some linking from the root to my directory that is not connected somehow.

I did the same in a clean project, and that worked fine, so I guess I have some package somewhere polluting the environment.

It might actually be the nodemodulespath that is missing in my configuration. I’ll try that out



I’ve created a boilerplate for using expo with lerna, maybe it might be useful for you.