Expo does not find “main” application in production build

I’ve been trying to fix this error from a couple weeks ago with no success. The problem is I cannot publish my app because of this.

When I build my expo app for any of both, iOS or Android, the Expo CLI signing process goes well, no errors and generates final bundles but when I install the spa or apk file into a real device it shows the splash screen 4 or 5 times in a row (some kind of loop) and finally shows the following error messages:

Checked out with no results:

Application main has not been registered

My package.json looks like this:

  "name": "Sxunco",
  "homepage": "https://www.sxunco.com",
  "version": "1.0.3",
  "private": true,
  "main": "node_modules/expo/AppEntry.js",
  "jest": {
    "preset": "jest-expo",
    "transformIgnorePatterns": [

My App.js:

import React from 'react';
import Root from './src/native/index';
import configureStore from './src/store/index';

const { persistor, store } = configureStore();

export default function App() {
  return <Root store={store} persistor={persistor} />;

Ive tried with same results:

  • Adding "appKey": "main" into app.json
  • Adding AppRegistry.registerComponent(‘main’, () => App); into App.js and also expo registerRootComponent(App) (separated and both together, none of that works)
  • Changing “main” path in package.json directly to App.js and register app with above methods manually

When I run build I also run:

exp start --no-dev --minify

So I wait for the server to finish loading and then run expo build:android

Please I don’t know what to do, I cannot publish my app because of this.

1 Like

Off hand I’m not sure what would cause this, but note that exp is the old client. The current one is called expo, from the expo-cli package.

Running expo diagnostics and pasting the results here might also be useful.

Thanks. I copy-pasted that reference of exp command, but Im always using expo new cli.

Running diagnostics throws following info:

MacBook-Pro-de-Karlo:sxunco-app-clientes karlo.lopez$ expo diagnostics
│                                                             │
│   There is a new version of expo-cli available (3.0.10).    │
│   You are currently using expo-cli 3.0.9                    │
│   Run `npm install -g expo-cli` to get the latest version   │
│                                                             │

  Expo CLI 3.0.9 environment info:
      OS: macOS 10.14.6
      Shell: 3.2.57 - /bin/bash
      Node: 12.4.0 - /usr/local/bin/node
      Yarn: 1.17.3 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
      Android Studio: 3.4 AI-183.6156.11.34.5692245
      Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
      expo: ^34.0.4 => 34.0.4 
      react: 16.8.3 => 16.8.3 
      react-native: https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz => 0.59.8 
      expo-cli: 3.0.9

MacBook-Pro-de-Karlo:sxunco-app-clientes karlo.lopez$

@karlolm how did you solve this issue ?

Can you two try creating a new app with expo init and try to publish it? If that works, start changing one small piece of the new app at a time to make it more like your real app. At some point either the new app will start getting the same error or else you will figure out the problem in the real app.

If you do the above and manage to reproduce the problem in the new app, but still can’t figure out what’s wrong, then you should have more info about the problem as a result and maybe someone here will be able to figure out what the problem is.

If you do figure it out by doing the above, please post your solution.

@karlolm did you solve this issue ?

I found the root cause of the problem and solved this issue :

  • I’m using bugsnag for debugging in dev, staging and production
  • in order to handle app crash, I’ve added the react plugin from bugsnag
  • after removing piece by piece, parts of the app, the only thing standing was App.js with quite nothing in it, except the View in render was surrounded by <ErrorBoundary> from bugsnagClient.getPlugin('react')
  • I removed this piece of $&#@ … and … tada … back to life !

I don’t have time to investigate why this crash silently in production only, I certainly misconfigured something … so let the app crash without handling this for the user (it sends the data to bugsnag that’s enough)


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