Error: EAS build failed in Prebuild(bash exited with non-zero code: 1)

  • Whether you are bare or managed workflow : managed
  • Your eas-cli version : 0.47.0
  • What you have tried so far :

When I tried to build my android app (source code is here), the build failed due to some errors.

The error statement is as follows.

[05:49:21] đź“ť  Android package Learn more: https://expo.fyi/android-package
[stderr] [05:49:21] Input is required, but Expo CLI is in non-interactive mode.
[stderr] Your project must have a `package` set in the Expo config (app.json or app.config.js).
[stderr] See https://expo.fyi/android-package
bash exited with non-zero code: 1

So, I checked package section in my app.config.js, but the package section is included.

I show you part of my app.config.js.

export default {
  name: 'SUEP',
  icon: './assets/suep_icon.png',
  version: process.env.MY_CUSTOM_PROJECT_VERSION || '1.1.3',
  orientation: 'portrait',
  splash: {
    image: './assets/splash.png',
    resizeMode: 'contain',
    backgroundColor: '#FFFFFF',
  },
  userInterfaceStyle: 'automatic',
  assetBundlePatterns: ['**/*'],
  updates: {
    fallbackToCacheTimeout: 10000,
  },
  android: {
    package: 'com.tpot.suepapp',
    versionCode: 12,
    permissions: [],
    adaptiveIcon: {
      foregroundImage: './assets/suep_icon.png',
      backgroundColor: '#FFFFFF',
    },
  },
  hooks: {
... 
  },
  plugins: ['sentry-expo'],
  extra: {
... 
  },
};

In addition, I tried expo build:android and it works without any errors.

I was doing some additional research and found this result in the “Read app config” section.
In app.config.js, the “name” and “version” are “SUEP” and “1.1.3”, but the “Read app config” section shows this.
Does this mean that the app.config.js is not being read properly in the eas build process?

Yeah, I think I might have figured it out.
My project does not have app.json, so app.json is required?
Maybe eas build won’t read any config file if only app.config.js exists?

Reference:

I’ll add app.json tomorrow when I have time and see if eas build works properly.

But is this specification (that app.config.js is not loaded without app.json) explicitly stated in any documentation?

There is no app.config.js in your Git repository. I see you have it in your .gitignore. Because of that, eas-cli will not upload it to the build servers.

I assume you have ignored it because of some secrets that you don’t want to commit? Have a look at the EAS docs on environment variables and secrets.

A workaround would be to copy .gitignore to .easignore and then remove app.config.js from .easignore. Then eas-cli will use .easignore instead of .gitignore. So your app.config.js will be uploaded to the build servers.

1 Like

Thank you for your kind reply!
Yes, as you said, I have included secret keys, etc. in app.config.js, so I don’t list them on GitHub with .gitignore.

I didn’t know that .easignore can override .gitignore. Thanks so much for pointing that out, I really appreciate it!

BTW, is the .easignore thing explicitly mentioned in the documentation somewhere? I’m really new to eas, so if there is detailed documentation somewhere, I’d be glad to know.

EAS is still fairly new, so I think there are still some gaps in the documentation.
I haven’t found a mention of .easignore in the docs on docs.expo.dev, but here are two from expo.fyi:

1 Like

I see. Then I’ll try to look for documentation from fyi or other links if I have any trouble with EAS build.
Thanks again for all your help!

1 Like

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