eas-cli icon indicating copy to clipboard operation
eas-cli copied to clipboard

"eas build --local" skips ignored files (.gitignore)

Open crutch12 opened this issue 1 year ago • 1 comments
trafficstars

Build/Submit details page URL

No response

Summary

eas build --local command skips ignored filed (.gitignore)

Why does it happen? It's strange behaviour

Managed or bare?

bare

Environment

[RUN_EXPO_DOCTOR] Running "expo doctor"
[RUN_EXPO_DOCTOR] Running 14 checks on your project...
[RUN_EXPO_DOCTOR] ✔ Check Expo config for common issues
[RUN_EXPO_DOCTOR] ✔ Check package.json for common issues
[RUN_EXPO_DOCTOR] ✔ Check dependencies for packages that should not be installed directly
[RUN_EXPO_DOCTOR] ✔ Check npm/ yarn versions
[RUN_EXPO_DOCTOR] ✔ Check if the project meets version requirements for submission to app stores
[RUN_EXPO_DOCTOR] ✖ Check for app config fields that may not be synced in a non-CNG project
[RUN_EXPO_DOCTOR] ✔ Check for common project setup issues
[RUN_EXPO_DOCTOR] ✔ Check Expo config (app.json/ app.config.js) schema
[RUN_EXPO_DOCTOR] ✔ Check native tooling versions
[RUN_EXPO_DOCTOR] ✔ Check for issues with metro config
[RUN_EXPO_DOCTOR] ✔ Check that native modules do not use incompatible support packages
[RUN_EXPO_DOCTOR] ✔ Check for legacy global CLI installed locally
[RUN_EXPO_DOCTOR] ✖ Check that packages match versions required by installed Expo SDK
[RUN_EXPO_DOCTOR] This project contains native project folders but also has native configuration properties in app.json, indicating it is configured to use Prebuild. When the android/ios folders are present, EAS Build will not sync the following properties: orientation, icon, userInterfaceStyle, splash, ios, android.
[RUN_EXPO_DOCTOR] ✔ Check that native modules use compatible support package versions for installed Expo SDK
[RUN_EXPO_DOCTOR] The following packages should be updated for best compatibility with the installed expo version:
[RUN_EXPO_DOCTOR] Detailed check results:
[RUN_EXPO_DOCTOR]   [email protected] - expected version: ~5.3.3
[RUN_EXPO_DOCTOR] Advice: Add '/android' and '/ios' to your .gitignore file if you intend to use CNG / Prebuild. Learn more: https://docs.expo.dev/workflow/prebuild/#usage-with-eas-build
[RUN_EXPO_DOCTOR] Your project may not work correctly until you install the expected versions of the packages.
[RUN_EXPO_DOCTOR] 
[RUN_EXPO_DOCTOR] Found outdated dependencies
[RUN_EXPO_DOCTOR] Advice: Use 'npx expo install --check' to review and upgrade your dependencies.
[PREPARE_CREDENTIALS] Preparing credentials
[RUN_EXPO_DOCTOR] One or more checks failed, indicating possible issues with the project.
[RUN_EXPO_DOCTOR] Command "expo doctor" failed.

Error output

[RUN_FASTLANE] ❌  Undefined symbols for architecture arm64
┌─ Symbol: _OBJC_CLASS_$_BLEAdvertiser
└─ Referenced from: in libreact-native-esmart.a[4](MyAppDelegate.o)

[RUN_FASTLANE] 
❌  ld: symbol(s) not found for architecture arm64


[RUN_FASTLANE] 
❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

This error occures because static library file (.a) is not included in build dir (skipped by .gitignore)

Reproducible demo or steps to reproduce from a blank project

❌ Github Action - eas build --local fails, because .a file ignored (with .gitignore) https://github.com/crutch12/expo-esmart-test/actions/runs/10992514166

✅ And this action works if I remove file from .gitignore https://github.com/crutch12/expo-esmart-test/actions/runs/10992531702

crutch12 avatar Sep 23 '24 11:09 crutch12

Why does it happen? It's strange behaviour

Local builds aim to emulate the behavior of EAS cloud builds. This is just an EAS cloud build process happening on your local machine (with some limitations). As of today it also follows the .gitignore the same way cloud builds do, which is on purpose to make it work very similar to cloud ones to be useful for debugging purposes. We can consider adding a special option ignoring .gitignore in the future, however, I can't promise anything here because our team is currently under a heavy workload. If you want to ignore a different set of files for your EAS build that is excluded by your .gitignore you can use .easignore https://docs.expo.dev/build-reference/easignore/. You can also use npx expo run:[ios|android] to create builds that don't respect the .gitignore file.

szdziedzic avatar Oct 15 '24 10:10 szdziedzic

Hi, We’re trying to build the project locally but ran into an issue where the .env variables weren't being loaded into the code. All along the problem was that we’re ignoring the .env file in our .gitignore? We don’t want to add our .env file to Git, but then where should we put our API keys and other sensitive data? Thanks!

dhcmega avatar Oct 31 '24 20:10 dhcmega

@dhcmega

  1. Copy whole .gitignore to .easignore in project's root dir
  2. Remove .env from .easignore
  3. Done

[!NOTE] Since .easignore fully disables eas's .gitignore files usage: If you have .gitignore files in subfolders and you want eas to skip its ignored files, you should duplicate its content in root .easignore

https://docs.expo.dev/build-reference/easignore/ By default, the EAS CLI refers to the .gitignore file (if it exists) to determine which files to ignore. If you create a .easignore file, the EAS CLI prioritizes it over the .gitignore file. When creating a .easignore file, include all files and directories from your .gitignore file and add additional files you want to ignore.

crutch12 avatar Nov 01 '24 08:11 crutch12

Thanks, I will test it next week. Regards!

dhcmega avatar Nov 02 '24 15:11 dhcmega

I had the same issue, @crutch12 solution works, I think it would be useful if when using --local, gitignore would be ignored.

avaziman avatar Nov 28 '24 13:11 avaziman

This issue is stale because it has been open for 30 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

github-actions[bot] avatar Dec 29 '24 00:12 github-actions[bot]

Here is solution: https://github.com/expo/eas-cli/issues/2594#issuecomment-2451482606

crutch12 avatar Dec 29 '24 11:12 crutch12