Running project on iOS simulator

Please provide the following:

  1. SDK Version: 3.27.10
    Node: 12.18.4
    Xcode: 12.0
  2. Platforms(Android/iOS/web/all): iOS

I’m having issues getting a new project to launch on an iOS simulator with the i command. I am also unable to install the expo app onto the simulator using

expo client:install:ios

I have tried switching node versions (12.13.0, 12.14.1, 12.18.4), uninstalling and reinstalling the expo-cli package via npm, creating another blank project with expo init, but no luck.

Error trying to run iOS app on simulator:

(node:30723) UnhandledPromiseRejectionWarning: Error: xcrun exited with non-zero code: 4
    at ChildProcess.completionListener (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
    at Object.onceWrapper (events.js:422:26)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
    ...
    at spawnAsync (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
    at xcrunAsync (/@expo/xdl@58.0.9/src/SimControl.ts:323:18)
    at Object.bootAsync (/@expo/xdl@58.0.9/src/SimControl.ts:137:11)
    at action (/@expo/xdl@58.0.9/src/Simulator.ts:310:25)
    at waitForActionAsync (/@expo/xdl@58.0.9/src/Simulator.ts:292:22)
    at ensureSimulatorOpenAsync (/@expo/xdl@58.0.9/src/Simulator.ts:207:24)
    at Object.openProjectAsync (/@expo/xdl@58.0.9/src/Simulator.ts:641:14)
    at ReadStream.handleKeypress (/usr/local/lib/node_modules/expo-cli/src/commands/start/TerminalUI.ts:246:11)
(node:30723) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
(node:30723) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Error trying to install expo client on simulator:

Error: xcrun exited with non-zero code: 4
    at ChildProcess.completionListener (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
    at Object.onceWrapper (events.js:422:26)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
    ...
    at spawnAsync (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
    at xcrunAsync (/@expo/xdl@58.0.9/src/SimControl.ts:323:18)
    at Object.bootAsync (/@expo/xdl@58.0.9/src/SimControl.ts:137:11)
    at action (/@expo/xdl@58.0.9/src/Simulator.ts:310:25)
    at waitForActionAsync (/@expo/xdl@58.0.9/src/Simulator.ts:292:22)
    at ensureSimulatorOpenAsync (/@expo/xdl@58.0.9/src/Simulator.ts:207:24)
    at Object.upgradeExpoAsync (/@expo/xdl@58.0.9/src/Simulator.ts:504:21)
    at /usr/local/lib/node_modules/expo-cli/src/commands/client/index.ts:321:11
    at Command.<anonymous> (/usr/local/lib/node_modules/expo-cli/src/exp.ts:302:7)

Both errors seem to point to an unhandled promise in the expo-cli global package at

@expo/spawn-async/src/spawnAsync.ts:65:13

Thank you for your help!

This happened to me today also, tried googling but no luck. I’ve upgraded expo SDK to latest version (39) and it seems to be working now.

try starting the simulator beforehand. usually when xcrun fails it is because something is wrong with the simulator process on your machine. you can try also try reseting the state of your simulator entirely by opening it and choosing this from the toolbar:
Screen Shot 2020-10-04 at 9.45.38 PM

2 Likes

Thanks for your response!

I have tried the “Erase All Content and Settings…” as well as using different iOS versions (12 and 14) but the same error is persisting. I have also confirmed that the Expo SDK is up to date.

Connecting to the Expo project with my physical device running iOS 14 is working.

I got the same issue today (simulator didn’t started even manually).

Solved by first upgrading xcode, then running

sudo xcode-select --reset

and then I opened Xcode manually once.

I tried before some other things, notably xcrun simctl erase all which delete all devices contents. It may be necessary in combination of the above trick as well.

I must add that the things started to go bad when I manually deleted cache directories of xcode… to leave enough space to download the update :wink:

1 Like

Any of the below or both should help

  1. Could be a permissions issue. Do not use sudo when using the command expo init projectname.
  2. If it fails, jJust rerun the command to run on ios simulator.
1 Like

Was banging my head with this issue myself for few hours.
MBP 2019 BigSur, vscode 1.51.1, expo 3.28.5, xcode 12.2 (12B45b)

I tried:

  1. Re-installing xcode
  2. Reinstalling xcode cli tools
  3. reseting xcode cli tools
  4. reinstalling vscode
  5. updated everything to the latest version
  6. running vscode as root

All the above did not fix it.

The only thing that solved it was running expo init without using sudo. When I initially ran expo init i did it with sudo in order to avoid any permissions issues - i was not able to start the app on ios simulator and was getting the same error. After tried many things I deleted the project folder and initialized it with using sudo. that fixed the issue for me eventually. There is a chance that everything I did prior helped in someway in combination of dropping “sudo” but i have no evidence to support it

@kwikmarts thanks!

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