LoginSignup
1
1

Expo > ローカルビルドが失敗する件の解決

Last updated at Posted at 2024-02-01

Expo SDK 50に対応するため作業を行なっていたところ、ローカルビルドが失敗するようになりました。

以下のようなエラーログが出て行き詰まってしまいました。

[INSTALL_PODS] ――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
[INSTALL_PODS] [!] Oh no, an error occurred.
[INSTALL_PODS] Search for existing GitHub issues similar to yours:
[INSTALL_PODS] https://github.com/CocoaPods/CocoaPods/search? 
	中略
%2Fopt%2Fhomebrew%2FCellar%2Fcocoapods%2F1.12.1%2Flibexec%2Fgems%2Fffi-1.15.5%2Flib%2Fffi_c.bundle&type=Issues
[INSTALL_PODS] If none exists, create a ticket, with the template displayed above, on:
[INSTALL_PODS] https://github.com/CocoaPods/CocoaPods/issues/new
[INSTALL_PODS] Be sure to first read the contributing guide for details on how to properly submit a ticket:
[INSTALL_PODS] https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
[INSTALL_PODS] Don't forget to anonymize any private data!
[INSTALL_PODS] Searching for inspections failed: undefined method `map' for nil
[INSTALL_PODS] [!] `<PBXResourcesBuildPhase UUID=`13B07F8E1A680F5B00A75B9A`>` attempted to initialize an object with an unknown UUID. `AF3AEBEE3B8041BCA17D5E54` for attribute: `files`. This can be the result of a merge and the unknown UUID is being discarded.
[INSTALL_PODS] Looking for related issues on cocoapods/cocoapods...
[INSTALL_PODS] 
Error: pod install exited with non-zero code: 1
    at ChildProcess.completionListener (/Users/user1/.npm/_npx/994d822063d9f19d/node_modules/@expo/spawn-async/build/spawnAsync.js:42:23)
    at Object.onceWrapper (node:events:632:26)
    at ChildProcess.emit (node:events:517:28)
    at maybeClose (node:internal/child_process:1098:16)
    at ChildProcess._handle.onexit (node:internal/child_process:303:5)
    ...
    at spawnAsync (/Users/user1/.npm/_npx/994d822063d9f19d/node_modules/@expo/spawn-async/build/spawnAsync.js:7:23)
    at spawn (/Users/user1/.npm/_npx/994d822063d9f19d/node_modules/@expo/turtle-spawn/dist/index.js:16:47)
    at installPods (/Users/user1/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/ios/pod.js:11:38)
    at /Users/user1/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/builders/ios.js:69:41
    at BuildContext.runBuildPhase (/Users/user1/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/context.js:98:34)
    at buildAsync (/Users/user1/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/builders/ios.js:68:19)
    at async runBuilderWithHooksAsync (/Users/user1/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/builders/common.js:12:13)
    at async Object.iosBuilder (/Users/user1/.npm/_npx/994d822063d9f19d/node_modules/@expo/build-tools/dist/builders/ios.js:28:16)
    at async buildIosAsync (/Users/user1/.npm/_npx/994d822063d9f19d/node_modules/eas-cli-local-build-plugin/dist/ios.js:66:12)
    at async buildAsync (/Users/user1/.npm/_npx/994d822063d9f19d/node_modules/eas-cli-local-build-plugin/dist/build.js:56:29)

Build failed
Unknown error. See logs of the Install pods build phase for more information.
npx exited with non-zero code: 1
    Error: build command failed.

Expo SDKを50へ上げたタイミングでエラーになるようになったので、SDK周りを疑い、Package.jsonから依存関係を抜いたりしつつビルドを試していきました。

expo-updatesを削除したらビルドが通るところまで行きましたが、expo-updatesは必要なモジュールなので根本解決には至りませんでした。

cocoapodのキャッシュを削除しても、入れ直しても現象は変わらず。

そうこうしていると、次の日には、expo-updatesを削除してもビルドが通らなくなりました。(その間、何も環境はさわっていないのに)

複数のMacでビルドを試しても同じ状況。これはまずいと腰を据えて問題解決することにしました。

spawnAsync.jsに着目して調べてましたが、どうにも違うっぽい。

まったく同じようなエラーを吐くISSUEを見つけたが、日付が2023年10月
https://github.com/OneSignal/react-native-onesignal/issues/1595

ということは、SDK50は関係ないようだ。

cocoapodsのISSUEへ

さまざまなISSUEを見ては彷徨い続け、たどり着いたのが以下のISSUE

Solved by downgrading cocoapods.

sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.14.3

1.14.3にダウングレードで問題解決とある。

cocoapodsのバージョン履歴を調べる。
https://rubygems.org/gems/cocoapods/versions?locale=ja

cocoapodsの全バージョン履歴
1.15.0 - January 28, 2024 (291KB)
1.14.3 - November 19, 2023 (291KB)
1.14.2 - October 27, 2023 (291KB)

Macにインストールバージョンを調べる。

pod --version
1.15.0

1.14.3にダウングレードしてみる。
ビルドが通った!!

1.15.0、俺はいつのまに入れたんだ!!

解決

brewでcocoapodsを入れていたのだが、
brewではバージョン指定できないらしいので、gemにてインストールしました。

やった方法は以下。

brew版のcocoapodsを削除

brew uninstall cocoapods

gemでcocoapodsのインストール

sudo gem install drb -v 2.0.6
sudo gem install activesupport -v 6.1.7.6
sudo gem install cocoapods -v 1.14.3

バージョン確認

pod --version
1.14.3

ビルドを試してみます。

eas build --profile development --platform ios --local

...
中略
....


Build successful
You can find the build artifacts in /Users/user1/project/build-1706792343593.tar.gz

ビルドができました!!

余談

さて、つい最近にcocoapods 1.15.0が出たばかりのようですが、入れた記憶がまったくありません。
いつのまにか無意識に、brewでcocoapodがアップデートをしたのかもしれないです。
(brewの自動アップデートはしていない)

ひとまず、Expoでローカルビルドに失敗する人は、cocoapodsのバージョンを疑ってみてはいかがでしょうか。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1