How to generate build files offline?

I’ve an expo managed project which I want to build without an internet connection. Just wanted to confirm if it’s even possible.

I’ve tried:

  1. expo eject: I tries to get a module from npm registry and hence fails.
  2. expo build:android: It requests exp.host and fails.

Is there any thing else or workaround that I can use? Or is there a way I can set proxy, so that it doesn’t use npm registry.

you could use turtle-cli and self-hosted bundle. For initial setup(or if you change sdk) internet connection is necessary to download the project templates.

js bundle with your project needs to be hosted somewhere, but if you want to do that without any internet connection you need to do that with local server:

  • expo export with URL to localhost (check help for specifics)
  • serve dist directory with e.g python3 -m http.server
  • turtle build:<platform> with public URL pointing to locally hosted manifest

Ok, thanks for the solution, the turtle-cli seems helpful. I hope expo-cli adds support for this in future.

Does the expo eject command sends any data outside or expo server.

it’s adding some packages to package.json and running yarn/npm install. I’m not aware of any other communication, but it’s possible that sth else might be sent there. e.g. expo servers might be contacted to check versions of those packages, but I’m not 100 % sure.

btw code for that is open source you can check there directly GitHub - expo/expo-cli: Tools for creating, running, and deploying universal Expo and React Native apps

I hope expo-cli adds support for this in future.

We created turtle-cli to allow running the same code as our cloud builds on local machines, why would we duplicate the same functionality in expo-cli?
Managed builds by definition can’t be fully offline because you need to have a way to download native code to build it.

  • in case of cloud builds we are handling that
  • in case of turtle-cli native code is downloaded for the first build and cached (so every next build can be offline)
  • in case expo eject it has to be downloaded on the fly, we could bundle that inside expo-cli but it would have significantly increased the size of the package and made updates more problematic

If you want to have fully offline builds you need to eject and keep the app ejected.

1 Like

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