Can't build ios app on connected device after expo init bare project

Can’t build the app on a real device:
Build fails with Command PhaseScriptExecution failed with a nonzero exit code.
Steps to reproduce:

  1. run expo init project
  2. choose Bare Workflow → minimal
  3. connect device
  4. open xCode and build the project

Diagnostics:
Expo CLI 3.19.2 environment info:
System:
OS: macOS Mojave 10.14.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
Yarn: 1.16.0 - ~/.nvm/versions/node/v10.15.3/bin/yarn
npm: 6.14.5 - ~/.nvm/versions/node/v10.15.3/bin/npm
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6626763
Xcode: 11.3/11C29 - /usr/bin/xcodebuild
npmPackages:
expo: ~38.0.9 => 38.0.9
react: ~16.11.0 => 16.11.0
react-native: ~0.62.2 => 0.62.2
npmGlobalPackages:
expo-cli: 3.19.2

update to the latest expo-cli version

edit: if that doesn’t help can you paste more of the log output related to the failed script execution?

info Writing bundle output to:, …/Library/Developer/Xcode/DerivedData/TestLatest-bmejjnfdwhzdfmekjsboazxvpbnj/Build/Products/Debug-iphoneos/TestLatest.app/main.jsbundle
info Done writing bundle output
info Copying 5 asset files
info Done copying assets

  • [[ true != true ]]
    …/node_modules/@expo/config/node_modules/fs-extra/lib/mkdirs/make-dir.js:86
    } catch {
    ^

SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions…js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object. (…/node_modules/@expo/config/node_modules/fs-extra/lib/mkdirs/index.js:3:44)

Update to latest did not help:
Expo CLI 3.24.2 environment info:
System:
OS: macOS Mojave 10.14.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
Yarn: 1.16.0 - ~/.nvm/versions/node/v10.15.3/bin/yarn
npm: 6.14.5 - ~/.nvm/versions/node/v10.15.3/bin/npm
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6626763
Xcode: 11.3/11C29 - /usr/bin/xcodebuild
npmPackages:
expo: ~38.0.9 => 38.0.9
react: ~16.11.0 => 16.11.0
react-dom: ~16.11.0 => 16.11.0
react-native: ~0.62.2 => 0.62.2
react-native-web: ~0.11.7 => 0.11.7
npmGlobalPackages:
expo-cli: 3.24.2

ah, you are using an unsupported node version. see: Installation - Expo Documentation - we recommend using the latest version or the latest LTS release

Even after updating to the latest node build fails with the same issue.
Expo CLI 3.24.2 environment info:
System:
OS: macOS Mojave 10.14.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.18.3 - ~/.nvm/versions/node/v12.18.3/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.14.6 - ~/.nvm/versions/node/v12.18.3/bin/npm
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6626763
Xcode: 11.3/11C29 - /usr/bin/xcodebuild
npmPackages:
expo: ~38.0.9 => 38.0.9
react: ~16.11.0 => 16.11.0
react-dom: ~16.11.0 => 16.11.0
react-native: ~0.62.2 => 0.62.2
react-native-web: ~0.11.7 => 0.11.7
npmGlobalPackages:
expo-cli: 3.24.2

Any other thoughts?

After updating expo-clii.
The error stack is:
internal/modules/cjs/loader.js:968
throw err;
^

Error: Cannot find module ‘getenv’

it sounds like something might be wrong with your node installation. do you have any other versions of node installed on your machine outside of nvm?

edit: nevermind, this appears to be a regression, will roll out a fix shortly

if you uninstall the expo-updates package and reinstall it you will get the fix.

yarn remove expo-updates
yarn add expo-updates

or with npm

npm uninstall expo-updates
npm install expo-updates

Yeah, it was really a node installation issue firstly.
@notbrent, thanks for your help with the expo-updates package.

1 Like

I’ve got the same issue: SyntaxError: Unexpected token { in fs-extra. OS: X 10.15.6, Xcode: Version 12.0 beta 6 (12A8189n).

$ npm --version
6.14.6
$ node --version
v12.18.3
$ expo-cli --version
3.25.1
$ npm info expo-updates version
0.2.14
$ npm info expo version
38.0.9
$ npm info react version
16.13.1
$ npm info react-native version
0.63.2

I’ve reinstalled node_modules, cleared all caches, etc. without luck. Even after updating to latest expo-updates with npm i expo-updates@0.3.1, running npx pod-install still I get the same error.

the syntax error that the OP wrote about was due to an incompatible node version: Can't build ios app on connected device after expo init bare project - #5 by notbrent

Thanks for the quick reply. I’m on node v12.18.3, which seems to be LTS, and so I assume this node version is compatible? Is there anything which needs to be done beyond what I’ve done (reinstalling node_modules, clearing cache, etc.) to make it work?

@dpwiese did you find any solution? I have the same issue.

Unfortunately no - I think I’ve left this project on Expo 37 and not revisited since my post above. I imagine I’ll revisit this sometime in the next few months, so hopefully there is a solution then!