Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suddenly, Expo SDK 48 iOS build failed in the fastlane #2169

Open
edilsonlsouza opened this issue Jan 6, 2024 · 15 comments
Open

Suddenly, Expo SDK 48 iOS build failed in the fastlane #2169

edilsonlsouza opened this issue Jan 6, 2024 · 15 comments
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@edilsonlsouza
Copy link

Build/Submit details page URL

https://expo.dev/accounts/edilsonlsouza/projects/provedor/builds/98991cb8-ed7c-4353-b88d-e0453c516784

Summary

I'm trying to build an iOS app from my managed Expo project. The build is failing at the Fastlane step. I think I might have selected something wrong during the process because this started happening out of nowhere, and now I can't build iOS for any project. I'm using Windows.

Managed or bare?

bare

Environment

npx expo-env-info:

expo-env-info 1.0.5 environment info:
System:
OS: Windows 10 10.0.22631
Binaries:
Node: 16.18.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.21 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: AI-223.8836.35.2231.11005911
npmPackages:
@expo/webpack-config: ^18.0.1 => 18.1.4
expo: ~48.0.4 => 48.0.21
react: 18.2.0 => 18.2.0
react-native: 0.71.14 => 0.71.14
Expo Workflow: managed

npx expo-doctor:

WARNING: We recommend using PowerShell or Bash via WSL 2 for development with Expo CLI on Windows. You may encounter issues using cmd.exe.

✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✖ Check Expo config (app.json/ app.config.js) schema
✔ Check that packages match versions required by installed Expo SDK
✔ Check that native modules do not use incompatible support packages
✔ Check for legacy global CLI installed locally
✔ Check that native modules use compatible support package versions for installed Expo SDK

Detailed check results:

Error: Problem validating asset fields in D:\PROVEDOR\SGP\Demo\app.json. Learn more: https://docs.expo.dev/
• Field: Android.adaptiveIcon.foregroundImage - image should be square, but the file at './assets/adaptive-icon.png' has dimensions 1025x1024.
• Field: icon - image should be square, but the file at './assets/icon.png' has dimensions 1025x1024.

One or more checks failed, indicating possible issues with the project.

Error output

› Compiling react-native-safe-area-context Pods/react-native-safe-area-context » RNCSafeAreaViewManager.m
Run script build phase '[CP-User] Generate app.config for prebuilt Constants.manifest' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'EXConstants' from project 'Pods')
Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Provedor' from project 'Provedor')
Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'Provedor' from project 'Provedor')
▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸ PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/expo/Library/Developer/Xcode/DerivedData/Provedor-eenohjajhyzizocoocnasrhbuisp/Build/Intermediates.noindex/ArchiveIntermediates/Provedor/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/FBReactNativeSpec.build/Script-46EB2E00016A70.sh (in target 'FBReactNativeSpec' from project 'Pods')
▸ (1 failure)
** ARCHIVE FAILED **
The following build commands failed:
PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/expo/Library/Developer/Xcode/DerivedData/Provedor-eenohjajhyzizocoocnasrhbuisp/Build/Intermediates.noindex/ArchiveIntermediates/Provedor/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/FBReactNativeSpec.build/Script-46EB2E00016A70.sh (in target 'FBReactNativeSpec' from project 'Pods')
(1 failure)
Exit status: 65
+-------------+-------------------------+
| Build environment |
+-------------+-------------------------+
| xcode_path | /Applications/Xcode.app |
| gym_version | 2.211.0 |
| sdk | iPhoneOS16.2.sdk |
+-------------+-------------------------+
Looks like fastlane ran into a build/archive error with your project
It's hard to tell what's causing the error, so we wrote some guides on how
to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
Before submitting an issue on GitHub, please follow the guide above and make
sure your project is set up correctly.
fastlane uses xcodebuild commands to generate your binary, you can see the
the full commands printed out in yellow in the above log.
Make sure to inspect the output above, as usually you'll find more error information there
[!] Error building the application - see the log above
Error: The "Run fastlane" step failed with an unknown error. Refer to "Xcode Logs" below for additional, more detailed logs.

Reproducible demo or steps to reproduce from a blank project

🍏 iOS build failed:
The "Run fastlane" (https://expo.dev/accounts/edilsonlsouza/projects/provedor/builds/8ae0ade1-caf5-48b7-9722-9b02819723d3#run-fastlane) step failed with an unknown error. Refer to the "Xcode logs" (https://expo.dev/accounts/edilsonlsouza/projects/provedor/builds/8ae0ade1-caf5-48b7-9722-9b02819723d3#xcode-logs) phase for additional, more detailed logs
error Command failed with exit code 1.

@edilsonlsouza edilsonlsouza added the needs review Issue is ready to be reviewed by a maintainer label Jan 6, 2024
@szdziedzic
Copy link
Member

Hi, did you find anything helpful in your Xcode logs? Your consecutive builds succeeded so I hope you resolved this issue, right?

@Anyamborogass
Copy link

Anyamborogass commented Jan 9, 2024

I believe the issue is associated with expo eas rather than any modifications in our code. Despite numerous unsuccessful attempts to build my latest code, I decided to test building an older version (from a week ago) that previously exhibited no issues. Surprisingly, the results were consistent. I had successfully generated a production build last week, and when attempting to run it today using git checkout last_successfull_build_commit_id -> eas build --platform ios --profile production, I encountered the same error:

** ARCHIVE FAILED **

The following build commands failed:

	PhaseScriptExecution [CP-User]\ [RNGoogleMobileAds]\ Configuration /Users/expo/Library/Developer/Xcode/DerivedData/eKisllat-cjevdpazeciaynbxgggtcszhylqx/Build/Intermediates.noindex/ArchiveIntermediates/eKisllat/IntermediateBuildFilesPath/eKisllat.build/Release-iphoneos/eKisllat.build/Script-C4AFF35B03DE8E78141EFC08.sh (in target 'eKisllat' from project 'eKisllat')

@szdziedzic
Copy link
Member

I believe that something that might have caused issues for @edilsonlsouza might be connected to the updated default Node version on EAS images https://expo.dev/changelog/2023/11-03-node-default (looking at when the last successful and first unsuccessful build after a break was done).

Unfortunately, I feel it's hard for me to help you @Anyamborogass as your issue might not necessarily be the same as the issue of @edilsonlsouz. What probably can help you is looking for errors in more detailed Xcode logs rather than less detailed Fastlane logs. Can you send me your build URL?

@Anyamborogass
Copy link

Anyamborogass commented Jan 9, 2024

Sure, here are my builds @szdziedzic :

  • Successfull build from last week: link
  • Failed build from last week run today: link
  • Latest failed build: link

There is another open issue that might be closer to my issue: #2126

@VictorioMolina
Copy link

VictorioMolina commented Jan 10, 2024

I am getting similar issue with iOS dev builds:

    export VERSION_INFO_FILE\=FBReactNativeSpec_vers.c
    export VERSION_INFO_STRING\=\"@\(\#\)PROGRAM:FBReactNativeSpec\ \ PROJECT:Pods-\"
    export WRAP_ASSET_PACKS_IN_SEPARATE_DIRECTORIES\=NO
    export XCODE_APP_SUPPORT_DIR\=/Applications/Xcode.app/Contents/Developer/Library/Xcode
    export XCODE_PRODUCT_BUILD_VERSION\=14C18
    export XCODE_VERSION_ACTUAL\=1420
    export XCODE_VERSION_MAJOR\=1400
    export XCODE_VERSION_MINOR\=1420
    export XPCSERVICES_FOLDER_PATH\=/XPCServices
    export YACC\=yacc
    export arch\=undefined_arch
    export variant\=normal
    /bin/sh -c /Users/expo/workingdir/build/packages/app/ios/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-46EB2E0005B950.sh
Node found at: /Users/expo/.nvm/versions/node/v18.18.0/bin/node
/Users/expo/workingdir/build/node_modules/cliui/build/index.cjs:291
const stringWidth = require('string-width');
                    ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/expo/workingdir/build/node_modules/string-width/index.js from /Users/expo/workingdir/build/node_modules/cliui/build/index.cjs not supported.
Instead change the require of index.js in /Users/expo/workingdir/build/node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/Users/expo/workingdir/build/node_modules/cliui/build/index.cjs:291:21)
    at Object.<anonymous> (/Users/expo/workingdir/build/node_modules/yargs/build/index.cjs:1:60678)
    at Object.<anonymous> (/Users/expo/workingdir/build/node_modules/yargs/index.cjs:5:30)
    at Object.<anonymous> (/Users/expo/workingdir/build/node_modules/react-native/scripts/generate-specs-cli.js:12:15) {
  code: 'ERR_REQUIRE_ESM'
}

...

The following build commands failed:
	PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/expo/workingdir/build/packages/app/ios/build/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-46EB2E0005B950.sh (in target 'FBReactNativeSpec' from project 'Pods')
(1 failure)

@szdziedzic
Copy link
Member

szdziedzic commented Jan 10, 2024

I see this in your Xcode logs phase @Anyamborogass:

/Users/expo/workingdir/build/app.config.js:23

export default {

^^^^^^

​

SyntaxError: Unexpected token 'export'

    at internalCompileFunction (node:internal/vm:73:18)

    at wrapSafe (node:internal/modules/cjs/loader:1178:20)

    at Module._compile (node:internal/modules/cjs/loader:1220:27)

    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)

    at Module.load (node:internal/modules/cjs/loader:1119:32)

    at Module._load (node:internal/modules/cjs/loader:960:12)

    at Module.require (node:internal/modules/cjs/loader:1143:19)

    at require (node:internal/modules/cjs/helpers:119:18)

    at [eval]:1:28

    at Script.runInThisContext (node:vm:123:12)

​

Node.js v18.18.0

Command PhaseScriptExecution failed with a nonzero exit code

If you use app.config.js you should use the module.exports syntax. Or if you want to use the export default syntax it should be app.config.ts. I believe it will solve your issue.
https://docs.expo.dev/workflow/configuration/

I think that another thing that might be helpful is fixing expo doctor warnings.

@Anyamborogass
Copy link

Thanks @szdziedzic, changing to module.exports syntax solved the problem.

I assume it is also related to the updated default Node version on EAS images.

@edilsonlsouza
Copy link
Author

edilsonlsouza commented Jan 10, 2024

Guys, I solved my problem by redoing the entire project, saving the screens, navigation, App.js, package.json and app.json. Thank you all!

@VictorioMolina
Copy link

VictorioMolina commented Jan 10, 2024

Guys, I solved my problem by redoing the entire project, saving the screens, navigation, App.js, package.json and app.json. Thank you all!

@edilsonlsouza Can you share your package.json and eas.json files?

@Anyamborogass did you find any workaround? I am experiencing the same in Expo 48 (no changes in the code).

@wodin
Copy link

wodin commented Jan 10, 2024

const stringWidth = require('string-width');
                    ^

Here's someone else who got this error message:
https://discord.com/channels/695411232856997968/1192555979980677271/1193882581251391488

Apparently, uninstalling @expo/config-plugins worked for them.

@VictorioMolina
Copy link

It seems we need to:

  1. Replace import/export syntax to CommonJS in app.config.js
  2. Remove @expo/* dependencies from package.json
  3. Solve expo linking warning if it appears when running yarn. Just do “yarn why expo-linking-warning-package-name” and solve the conflict of the parent by installing the expected version.

Will try and come back to say something tomorrow because I am trying to solve this issue since yesterday 😅

@marcosrm182
Copy link

@VictorioMolina
Did you manage to solve this? I have the same problem.

@EmanuelOcampo
Copy link

up

@JosDaw
Copy link

JosDaw commented Mar 12, 2024

I believe the issue is associated with expo eas rather than any modifications in our code. Despite numerous unsuccessful attempts to build my latest code, I decided to test building an older version (from a week ago) that previously exhibited no issues. Surprisingly, the results were consistent. I had successfully generated a production build last week, and when attempting to run it today using git checkout last_successfull_build_commit_id -> eas build --platform ios --profile production, I encountered the same error:

** ARCHIVE FAILED **

The following build commands failed:

	PhaseScriptExecution [CP-User]\ [RNGoogleMobileAds]\ Configuration /Users/expo/Library/Developer/Xcode/DerivedData/eKisllat-cjevdpazeciaynbxgggtcszhylqx/Build/Intermediates.noindex/ArchiveIntermediates/eKisllat/IntermediateBuildFilesPath/eKisllat.build/Release-iphoneos/eKisllat.build/Script-C4AFF35B03DE8E78141EFC08.sh (in target 'eKisllat' from project 'eKisllat')

I experienced this exact issue. The solution was

  1. npm uninstall @expo/config-plugins
  2. Rename app.config.js -> app.config.ts with export default ({ config }) => ({ ...

Build finally completed.

@wishup-agrit
Copy link

@edilsonlsouza Does sharing private link in reproducible example works, that's why stopped myself from creating the issue. I am slo facing the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

9 participants