I keep getting this error when running 'expo build:ios' - error: 'bash exited with non-zero code: 127'

I keep getting this error when trying to build an iOS app version.

I’ve enabled WSL and installed Ubuntu app from Windows store. In addition, I’ve open admin Powershell and ran “Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux”

My diagnostics: image

Reference post: Build:ios - cant authenticate with Apple Developer Portal - #8 by wkozyra

Has anyone encountered this problem? And how can I fix it, I’m not sure what to try. Thanks

1 Like

+1 on this - i’m also getting it.

The error implies that bash is unable to find fastlane.

Are you running expo build:ios at the bash prompt (under WSL)? Or at the cmd.exe prompt? Or from within powershell?

Also, it looks like you’re using npm as opposed to yarn. Did you run npm install at the same prompt that you’re using to run expo build:ios?

EDIT: I suppose npm install -g expo-cli is more relevant than npm install in the project.

I have a suspicion that npm might have installed the Windows version of fastlane and expo build:ios is looking for a Linux version or vice versa.

By the way, expo-cli 3.4.0 has just been released. You might want to upgrade since that fixed some issues with publishing.

I’m running it in cmd inside of VSCode. But I tried it as admin with Powershell as well.

I was running this on a Windows 10 with WSL enabled.

Thanks - just updated the version.

From what environment did you run npm install -g expo-cli?

Hi, I am also having this problem. I have tried running expo build:ios in ps and cmd. Here is my error message.

Error: bash exited with non-zero code: 127
    at ChildProcess.completionListener (C:\Users\Jack Fetzer\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:65:13)
    at Object.onceWrapper (events.js:284:20)
    at ChildProcess.emit (events.js:196:13)
    at ChildProcess.cp.emit (C:\Users\Jack Fetzer\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (internal/child_process.js:1000:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)
    at spawnAsync (C:\Users\Jack Fetzer\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:26:19)
    at runAction (C:\expo-cli@3.4.0\src\commands\build\ios\appleApi\fastlane.js:16:28)
    at Object.authenticate (C:\expo-cli@3.4.0\src\commands\build\ios\appleApi\authenticate.js:15:46)
    at processTicksAndRejections (internal/process/task_queues.js:88:5)
    at IOSBuilder.getAppleCtx (C:\expo-cli@3.4.0\src\commands\build\ios\IOSBuilder.js:47:24)
    at IOSBuilder.produceMissingCredentials (C:\expo-cli@3.4.0\src\commands\build\ios\IOSBuilder.js:123:22)
    at IOSBuilder.prepareCredentials (C:\expo-cli@3.4.0\src\commands\build\ios\IOSBuilder.js:66:7)
    at IOSBuilder.run (C:\expo-cli@3.4.0\src\commands\build\ios\IOSBuilder.js:19:7)
    at IOSBuilder.command (C:\expo-cli@3.4.0\src\commands\build\BaseBuilder.js:54:7)
    at Command.<anonymous> (C:\expo-cli@3.4.0\src\exp.ts:81:7)


I have the same question for you:

It might help if you do one of the following:

  1. Uninstall expo-cli and reinstall it from powershell, and run expo build:ios also from powershell.
  2. Uninstall expo-cli and reinstall it from bash, then run expo build:ios also from bash.

Alright so I ran expo install -g expo-cli after uninstalling expo-cli both in powershell and in bash. In powershell, everything installed fine but it did not work. As for bash, I got this error…

: not foundram Files/nodejs/npm: 3: /mnt/c/Program Files/nodejs/npm:
: not foundram Files/nodejs/npm: 5: /mnt/c/Program Files/nodejs/npm:
/mnt/c/Program Files/nodejs/npm: 6: /mnt/c/Program Files/nodejs/npm: Syntax error: word unexpected (expecting "in")

I tried that in both cmd and powershell without it working.

Also tried uninstalling & reinstalling expo. Doesn’t seem to be it.

OK, at this point I’ve run out of ideas other than maybe installing a Linux VM :frowning:

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