expo eject - can't build iOS with latest version

I think I have the same problem, with exactly the same error message. I didn’t use NVM though. All I did is calling expo eject and I select ExpoKit.

It would be great to get a response from Expo on this. Having the exact same issue. Being told to install expo-cli, even though it is installed and running ‘expo’ commands in the cli works normally.

1 Like

Here is how I tracked it down. After ejection:

  1. open the ios workspace file in xcode
  2. go to project navigator --> Build phases --> Prepare Expo
  3. Insert whatever debug code you need to here. I think i tried just running ‘expo’, then hacking the PATH, etc.
  4. In the error, it outputs everything that happens in this script.

Be warned: There is a similar script in “Bundle expo assets” phase that only gets run in prod mode.

Hi, sorry for this inconvenience :disappointed: We’re looking into this and will reach out to you once we find universal solution and fix it.
For now, I can confirm that what @cdelcol wrote above is correct and should be enough to workaround this problem.

1 Like

Could you provide a code snippet? I’m still struggling to get this to work. I tried hard coding the PATH so that it leads to expo, and running it in command line works just fine, but still fails in Xcode.

Here’s a snippet of what I have:

PATH="/Users/jordanestes/.nvm/versions/node/v8.9.1/bin/expo" $expo prepare-detached-build --platform ios

Do you see anything wrong?

We’ve just released a new version of ExpoKit (v2.8.4) which solves this issue. Unfortunately, you might need to do expo eject again or just apply below changes to your Xcode project configuration in “Build Phases” tab.

Correct script for “Prepare Expo” phase:

set -eo pipefail

pushd "${SRCROOT}/.."
value="$(cat ~/.expo/PATH)"
PATH="$PATH:$value" expo prepare-detached-build --platform ios
popd

and for “Bundle Expo Assets” phase:

set -eo pipefail

if [ "$CONFIGURATION" == "Debug" ]; then
  echo "Skipping asset bundling in debug mode."
  exit 0
fi

pushd "${SRCROOT}/.."
value="$(cat ~/.expo/PATH)"
dest="$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"
PATH="$PATH:$value" expo bundle-assets --platform ios --dest "$dest"
popd
1 Like

:smile: I did this:

 nvm deactivate // remove the nvm path
brew install node //install node at a global location
yarn global install expo-cli //now installs somewhere in a normal non-nvm path

That is it. When I re-open the terminal nvm is back, but the global node with expo-cli just sit there unused except for by xcode. I just have to remember to upgrade it in the extra location.

Yeah, it was also a good workaround for this issue but with the scripts I posted above (or in newly ejected app that already contains them) you don’t need to remember to upgrade global (non-nvm) expo-cli :wink: So I recommend this solution anyway :slightly_smiling_face:

I just rebuilt my project from expo init and expo eject and am still receiving the same error. I am getting this error when trying to archive.

Command PhaseScriptExecution failed with a nonzero exit code

Do you have any suggestions what I can try or what information I can provide to try to resolve this?

Hey @scasarotto,

Could you check if the scripts that you have in Xcode project settings -> Build Phases are the same that I posted above?

Yeah they are:

Prepare Expo:

set -eo pipefail

pushd "${SRCROOT}/.."
value="$(cat ~/.expo/PATH)"
PATH="$PATH:$value" expo prepare-detached-build --platform ios
popd

Build Expo Assets:

set -eo pipefail

if [ "$CONFIGURATION" == "Debug" ]; then
  echo "Skipping asset bundling in debug mode."
  exit 0
fi

pushd "${SRCROOT}/.."
value="$(cat ~/.expo/PATH)"
dest="$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH"
PATH="$PATH:$value" expo bundle-assets --platform ios --dest "$dest"
popd

Also, I tried not rebuilding from expo init but just adding these scripts and that didn’t fix it either for me when archiving.

So, if I understand correctly, you can build it, but you can’t archive it? That’s weird :thinking: Could you try to expand Xcode logs to get more details on what failed in the script?

Yeah I can build and run on simulator just fine. (Was able to even before running into this error when archiving.)

Xcode Error Output. Let me know if more would be helpful.

~/Documents/38thStreetStudios/Work/FirstClassDispatch/fc-chauffeur ~/Documents/38thStreetStudios/Work/FirstClassDispatch/fc-chauffeur/ios
[12:59:29] Error reading the manifest file. Make sure the path '/Users/stuartcasarotto/Documents/38thStreetStudios/Work/FirstClassDispatch/fc-chauffeur/ios/fc-chauffeur/Supporting/shell-app-manifest.json' is correct.

Error: Unexpected end of JSON input
[12:59:29] Set EXPO_DEBUG=true in your env to view the stack trace.
Command PhaseScriptExecution failed with a nonzero exit code

When I look into that file I see a blank file. Is it expected to be an empty file?

EDIT: Maybe my issue is separate from this. Happy to start a different thread.
EDIT 2: Can recreate this with the following steps:

  1. expo init
  2. yarn install
  3. Add ios/bundleIdentifier and android/package to app.json
  4. expo eject
  5. cd ios
  6. pod install
  7. Open in xcode and attempt to archive

It looks like you need to run expo publish before you try to archive. It should generate shell app manifest which is then bundled in the app.
Let me know if that helped! :wink:

1 Like

Ah really sorry about this. All the threads mentioning Command PhaseScriptExecution failed with a nonzero exit code pointed back here.

Really appreciate your help.

Was having the exact same issue. Unable to archive. I’ve been having problems with OTA updates not sending assets correctly, so wanted to avoid publishing, but as long as I have “enabled” set to false for OTA, it shouldn’t matter, right?

Hey @estesjl,
Yeah, it shouldn’t matter. You need to run publish to generate a manifest and JS bundle so they can be included in your native build :wink:

Can you also describe your problems with OTA? Have you already created a thread for this?

Sure. I had an unresolved issue here: Assets not Uploaded on Publish SDK30

I have this problem only on ExpoKit as far as I can tell. And it may be related to my other issue: Include local CSS/JavaScript in WebView, which hasn’t received a response. (Trying to include local JS and CSS in a webview without detaching). It works before I publish, but as soon as I publish I can no longer reach local files in Webview. I was able to solve that by detaching and creating new assets folders in Android Studio and Xcode, but wasn’t a great solution.

I really could use help on the Android asset bundling issue in particular. I’ve lost days trying to get my assets to show up after detaching (works fine before, but am forced to detach because of the other issue I highlighted - getting CSS and JS to load in a Webview)…

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