【Expo】eas build --platform iosのiOS build failedを解決する

# 問題
- マネージドのExpoのプロジェクトで
- `eas build --platform ios`を実行した結果
- `iOS build failed`エラーが発生した
- しかし`expo start`では問題なくアプリが動作する

# エラー内容
同じ問題で詰まっている人の検索に引っかかりやすいようにエラー文を載せる


`eas build --platform ios`を実行したターミナルのエラー出力
```
✖ Build failed

🍎 iOS build failed:
Fastlane build failed with unknown error. Please refer to the "Run fastlane" and "Xcode Logs" phases.
Fastlane errors in most cases are not printed at the end of the output, so you may not find any useful information in the last lines of output when looking for an error message.
error Command failed with exit code 1.
```

Expoの管理画面のBuildsの中、Run fastlaneのエラー出力
```

❌  error: File /Users/expo/Library/Developer/Xcode/DerivedData/app-gfczuwoxhhirjpelxqecjxyrawps/Build/Intermediates.noindex/ArchiveIntermediates/app/BuildProductsPath/Release-iphoneos/app.app/main.jsbundle does not exist. This must be a bug with

› Generating debug app » app.app.dSYM
▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸ 	PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/expo/Library/Developer/Xcode/DerivedData/app-gfczuwoxhhirjpelxqecjxyrawps/Build/Intermediates.noindex/ArchiveIntermediates/app/IntermediateBuildFilesPath/app.build/Release-iphoneos/app.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'app' from project 'app')
▸ (1 failure)
2022-08-22 04:32:50.252 xcodebuild[4247:12495] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-08-22 04:32:50.252 xcodebuild[4247:12495] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-08-22 04:32:50.327 xcodebuild[4247:12495] XType: failed to connect - Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.fonts was invalidated: failed at lookup with error 3 - No such process." UserInfo={NSDebugDescription=The connection to service named com.apple.fonts was invalidated: failed at lookup with error 3 - No such process.}
2022-08-22 04:32:50.327 xcodebuild[4247:12495] Font server protocol version mismatch (expected:5 got:0), falling back to local fonts
2022-08-22 04:32:50.327 xcodebuild[4247:12495] XType: unable to make a connection to the font daemon!
2022-08-22 04:32:50.327 xcodebuild[4247:12495] XType: XTFontStaticRegistry is enabled as fontd is not available.
** ARCHIVE FAILED **
The following build commands failed:
	PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/expo/Library/Developer/Xcode/DerivedData/app-gfczuwoxhhirjpelxqecjxyrawps/Build/Intermediates.noindex/ArchiveIntermediates/app/IntermediateBuildFilesPath/app.build/Release-iphoneos/app.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'app' from project 'app')
(1 failure)
```

Expoの管理画面のBuildsの中、Fail buildのエラー出力
```
Build failed: Fastlane build failed with unknown error. Please refer to the "Run fastlane" and "Xcode Logs" phases.
Fastlane errors in most cases are not printed at the end of the output, so you may not find any useful information in the last lines of output when looking for an error message.
```


Xcode Logsのエラー出力
```
error Unable to resolve module ./src/provider/Provider from /Users/expo/workingdir/build/App.tsx: 

None of these files exist:
  * src/provider/Provider(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
  * src/provider/Provider/index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
[0m [90m  6 |[39m   [33mKeyboard[39m[33m,[39m[0m
[0m [90m  7 |[39m } [36mfrom[39m [32m"react-native"[39m[33m;[39m[0m
[0m[31m[1m>[22m[39m[90m  8 |[39m [36mimport[39m [33mProvider[39m [36mfrom[39m [32m"./src/provider/Provider"[39m[33m;[39m[0m
[0m [90m    |[39m                       [31m[1m^[22m[39m[0m
[0m [90m  9 |[39m [36mimport[39m [33mNavigation[39m [36mfrom[39m [32m"./src/Navigation/Navigation"[39m[33m;[39m[0m
[0m [90m 10 |[39m [90m// import Provider from "./src/provider/Provider";[39m[0m
[0m [90m 11 |[39m[0m.
Error: Unable to resolve module ./src/provider/Provider from /Users/expo/workingdir/build/App.tsx: 

None of these files exist:
  * src/provider/Provider(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
  * src/provider/Provider/index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
```

# 解決方法
import文のfrom以降のパスの大文字小文字が間違えていることが原因だった。

自分の場合は`App.tsx`のなかの`import Provider from "./src/provider/Provider"`の部分。
正しいパスは`import Provider from "./src/Provider/Provider"`であり、途中のproviderのpは大文字出なければならなかった。

どこが間違っているかはXcode Logsの中の
`error Unable to resolve module ./src/provider/Provider from /Users/expo/workingdir/build/App.tsx: 
`
の部分を見ればわかるので、そこのパスが間違えていないか確認するとよい。


# まとめ
- 最初`** ARCHIVE FAILED **`の部分に着目し、証明書関連のエラーかと思い、証明書を作り直したりExpoプロジェクトを作り直したりかなり手を焼いたが、とてもしょうもないミスだった。
- とはいえパスの大文字小文字を間違えていても`expo start`では問題なく動いてしまうので、やっかいなエラーだと思う（言い訳）
- 今回は単純なパスの問題だったけど、fastlaneでコケるのは他にも色々原因があるようなので、同じくfastlaneでコケた人はどうか心を強くもって頑張って解決してほしい。
    - 他のコケる例　→ [eas build error - unable to resolve aws-exports.js](https://github.com/expo/eas-cli/issues/906)





Twitterもやってるので、よければフォローお願いします。
→https://twitter.com/ObataGenta