[Capacitor] 在 Apple M3 上編譯 iOS app 失敗,出現 Skipping pod install because CocoaPods is not installed 錯誤?

[Capacitor] 在 Apple M3 上編譯 iOS app 失敗,出現 Skipping pod install because CocoaPods is not installed 錯誤?

最近剛拿到公司的 Mac Book Pro M3,

想用 Capacitor 編譯 iOS app 時,

出現了 Skipping pod install because CocoaPods is not installed 的錯誤訊息:

$ npx cap run ios

✔ Copying web assets from www to ios/App/App/public in 75.21ms
✔ Creating capacitor.config.json in ios/App/App in 540.13μs
[info] Inlining sourcemaps
✔ copy ios in 83.09ms
✔ Updating iOS plugins in 481.67μs
[warn] Skipping pod install because CocoaPods is not installed
✔ Updating iOS native dependencies with pod install in 747.37ms
✔ update ios in 787.30ms
[error] native-run failed with error

        [object Object]: Unable to retrieve simulator list: Reduce of empty array with no initial value

 

雖然好像只是個警告訊息,但接下來的編譯就都沒有成功…

照著網路上的文章,想用 gem 來安裝 CocoaPods,

(gem 是 Ruby 的套件管理員,CocoaPods 是 Swift/Objective-C 的套件管理員)

印象中在舊的 Mac Book Pro (Intel) 沒有問題,

但在 Apple M3 上就卡住了… 我只能按 Ctrl-C 來中斷:

$ sudo gem install cocoapods

^CERROR:  Interrupted

 

加上  --debug 參數看看它在做什麼…

它陷在無窮迴圈,感覺像是有檔案不存在,但我也不知道原因…

$ gem install --debug cocoapods

NOTE:  Debugging mode prints all exceptions even when rescued
Exception `LoadError' at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/resolv.rb:170 - LoadError
Exception `Gem::RemoteFetcher::FetchError' at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/remote_fetcher.rb:244 - bad response Not Found 404 (https://rubygems.org/api/v1/dependencies)
Exception `Gem::RemoteFetcher::FetchError' at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/remote_fetcher.rb:274 - bad response Not Found 404 (https://rubygems.org/api/v1/dependencies)
Exception `Errno::EEXIST' at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:239 - File exists @ dir_s_mkdir - /Users/testuser/.gem/specs/rubygems.org%443
Exception `Errno::EEXIST' at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:239 - File exists @ dir_s_mkdir - /Users/testuser/.gem/specs/rubygems.org%443
Exception `Errno::EEXIST' at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:239 - File exists @ dir_s_mkdir - /Users/testuser/.gem/specs/rubygems.org%443/quick/Marshal.4.8
Exception `Errno::EEXIST' at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/fileutils.rb:239 - File exists @ dir_s_mkdir - /Users/testuser/.gem/specs/rubygems.org%443/quick/Marshal.4.8
......

 

亂爬文的時候,看到有人是用 Homebrew 來安裝 CocoaPods 的,

一試就成功了,有看到它是去抓 arm64 用的套件:

brew install cocoapods

 

再度用 Capacitor 來編譯,這次就成功囉~

$ npx cap run ios

✔ Copying web assets from www to ios/App/App/public in 77.52ms
✔ Creating capacitor.config.json in ios/App/App in 512.04μs
[info] Inlining sourcemaps
✔ copy ios in 85.72ms
✔ Updating iOS plugins in 429.21μs
✔ Updating iOS native dependencies with pod install in 1.96s
✔ update ios in 2.02s
✔ Please choose a target device: › iPhone 15 Pro Max (simulator) (54F8AB04-85EF-471C-AC2E-439883B98D00)
✔ Running xcodebuild in 20.07s
✔ Deploying App.app to 54F8AB04-85EF-471C-AC2E-439883B98D00 in 23.68s

 

(本頁面已被瀏覽過 111 次)

2 thoughts on “[Capacitor] 在 Apple M3 上編譯 iOS app 失敗,出現 Skipping pod install because CocoaPods is not installed 錯誤?

  1. 您好EPH程式日記,我想尋求你幫忙。
    我的WORD論文,遇到xml parsing error這個問題,顯示行:1174欖:17956594,導致檔案打不開,我有看你之前發表的日記,但沒有程式背景,對我來說根本亂碼。
    我好難過……我打超久的論文都沒了。

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料