facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.09k stars 24.19k forks source link

[SOLVED] React Native 0.70.0 iOs fresh project errors out on `run-ios` #34608

Closed Bayramito closed 1 year ago

Bayramito commented 2 years ago

edit by @kelset: this issue is caused by the Ruby version installed. Please refer to this comment for steps to fix it.


I just wanted to try out the latest release from yesterday which is 0.70, but did not work at all as a default empty project

It's immediately crashing when i run it

Description ### Description `Translated Report (Full Report Below) ------------------------------------- Incident Identifier: B813BAD6-A8CA-4003-B965-6FE4733EC654 CrashReporter Key: 6FE47381-36D7-18B0-B222-F84F8B90D961 Hardware Model: MacBookPro16,1 Process: testproject [10096] Path: /Users/USER/Library/Developer/CoreSimulator/Devices/5ECF7949-51A1-4E17-B4CE-E7186750E864/data/Containers/Bundle/Application/5089FB61-ED38-4EA9-B58F-6395012D6D83/testproject.app/testproject Identifier: org.reactjs.native.example.testproject Version: 1.0 (1) Code Type: X86-64 (Native) Role: Foreground Parent Process: launchd_sim [7524] Coalition: com.apple.CoreSimulator.SimDevice.5ECF7949-51A1-4E17-B4CE-E7186750E864 [31205] Responsible Process: SimulatorTrampoline [3271] Date/Time: 2022-09-06 14:53:35.0726 +0300 Launch Time: 2022-09-06 14:53:35.0415 +0300 OS Version: macOS 12.5.1 (21G83) Release Type: User Report Version: 104 Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: DYLD 1 Library missing Library not loaded: @rpath/hermes.framework/hermes Referenced from: /Users/USER/Library/Developer/CoreSimulator/Devices/5ECF7949-51A1-4E17-B4CE-E7186750E864/data/Containers/Bundle/Application/5089FB61-ED38-4EA9-B58F-6395012D6D83/testproject.app/testproject Reason: tried: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/hermes.framework/hermes' (no such file), '/usr/lib/swift/hermes.framework/hermes' (no such file), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/hermes.framework/hermes' (no such file), '/usr/lib/swift/hermes.framework/hermes' (no such file), '/Users/bayram/Library/Developer/CoreSimulator/Devices/5ECF7949-51A1-4E17-B4CE-E7186750E864/data/Containers/Bundle/Application/5089FB61-ED38-4EA9-B58F-6395012D6D83/testproject.app/Frame (terminated at launch; ignore backtrace) Triggered by Thread: 0 Thread 0 Crashed: 0 dyld 0x11192298e __abort_with_payload + 10 1 dyld 0x111938a72 abort_with_payload_wrapper_internal + 80 2 dyld 0x111938aa4 abort_with_payload + 9 3 dyld_sim 0x10d0108eb abort_with_payload + 26 4 dyld_sim 0x10cfd04eb dyld4::halt(char const*) + 375 5 dyld_sim 0x10cfccc1c dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3070 6 dyld_sim 0x10cfcce42 _dyld_sim_prepare + 379 7 dyld 0x1118e2b78 dyld4::prepareSim(dyld4::RuntimeState&, char const*) + 1265 8 dyld 0x1118e170e dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 244 9 dyld 0x1118e14e4 start + 388 Thread 0 crashed with X86 Thread State (64-bit): rax: 0x0000000002000209 rbx: 0x0000000000000000 rcx: 0x00007ff7b6201378 rdx: 0x00007ff7b62017f0 rdi: 0x0000000000000006 rsi: 0x0000000000000001 rbp: 0x00007ff7b62013c0 rsp: 0x00007ff7b6201378 r8: 0x00007ff7b62013f0 r9: 0x0000000000000000 r10: 0x00000000000000f2 r11: 0x0000000000000246 r12: 0x00000000000000f2 r13: 0x00007ff7b62017f0 r14: 0x0000000000000001 r15: 0x0000000000000006 rip: 0x000000011192298e rfl: 0x0000000000000246 cr2: 0x000000010cfd2936 Logical CPU: 0 Error Code: 0x02000209 Trap Number: 133 Binary Images: 0x1118dc000 - 0x111947fff dyld (*) /usr/lib/dyld 0x10cfcb000 - 0x10d018fff dyld_sim (*) <7276a69b-e3b9-3f23-957f-061350a501b4> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/dyld_sim EOF ----------- Full Report ----------- {"app_name":"testproject","timestamp":"2022-09-06 14:53:36.00 +0300","app_version":"1.0","slice_uuid":"fc94d75e-c756-329b-b797-552f61806eb0","build_version":"1","platform":7,"bundleID":"org.reactjs.native.example.testproject","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"macOS 12.5.1 (21G83)","incident_id":"B813BAD6-A8CA-4003-B965-6FE4733EC654","name":"testproject"} { "uptime" : 260000, "procLaunch" : "2022-09-06 14:53:35.0415 +0300", "procRole" : "Foreground", "version" : 2, "userID" : 501, "deployVersion" : 210, "modelCode" : "MacBookPro16,1", "procStartAbsTime" : 267874854474379, "coalitionID" : 31205, "osVersion" : { "train" : "macOS 12.5.1", "build" : "21G83", "releaseType" : "User" }, "captureTime" : "2022-09-06 14:53:35.0726 +0300", "incident" : "B813BAD6-A8CA-4003-B965-6FE4733EC654", "bug_type" : "309", "pid" : 10096, "procExitAbsTime" : 267874882079016, "cpuType" : "X86-64", "procName" : "testproject", "procPath" : "\/Users\/USER\/Library\/Developer\/CoreSimulator\/Devices\/5ECF7949-51A1-4E17-B4CE-E7186750E864\/data\/Containers\/Bundle\/Application\/5089FB61-ED38-4EA9-B58F-6395012D6D83\/testproject.app\/testproject", "bundleInfo" : {"CFBundleShortVersionString":"1.0","CFBundleVersion":"1","CFBundleIdentifier":"org.reactjs.native.example.testproject"}, "storeInfo" : {"deviceIdentifierForVendor":"28A0FF8E-0D5D-5562-9A29-B4461B2CCBD9","thirdParty":true}, "parentProc" : "launchd_sim", "parentPid" : 7524, "coalitionName" : "com.apple.CoreSimulator.SimDevice.5ECF7949-51A1-4E17-B4CE-E7186750E864", "crashReporterKey" : "6FE47381-36D7-18B0-B222-F84F8B90D961", "responsiblePid" : 3271, "responsibleProc" : "SimulatorTrampoline", "wakeTime" : 1914, "bridgeVersion" : {"build":"19P6066","train":"6.6"}, "sleepWakeUUID" : "E9160E8F-12B5-448F-8AC0-AFA83A735033", "sip" : "enabled", "isCorpse" : 1, "exception" : {"codes":"0x0000000000000000, 0x0000000000000000","rawCodes":[0,0],"type":"EXC_CRASH","signal":"SIGABRT"}, "termination" : {"code":1,"flags":518,"namespace":"DYLD","indicator":"Library missing","details":["(terminated at launch; ignore backtrace)"],"reasons":["Library not loaded: @rpath\/hermes.framework\/hermes","Referenced from: \/Users\/USER\/Library\/Developer\/CoreSimulator\/Devices\/5ECF7949-51A1-4E17-B4CE-E7186750E864\/data\/Containers\/Bundle\/Application\/5089FB61-ED38-4EA9-B58F-6395012D6D83\/testproject.app\/testproject","Reason: tried: '\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime\/Contents\/Resources\/RuntimeRoot\/usr\/lib\/swift\/hermes.framework\/hermes' (no such file), '\/usr\/lib\/swift\/hermes.framework\/hermes' (no such file), '\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime\/Contents\/Resources\/RuntimeRoot\/usr\/lib\/swift\/hermes.framework\/hermes' (no such file), '\/usr\/lib\/swift\/hermes.framework\/hermes' (no such file), '\/Users\/bayram\/Library\/Developer\/CoreSimulator\/Devices\/5ECF7949-51A1-4E17-B4CE-E7186750E864\/data\/Containers\/Bundle\/Application\/5089FB61-ED38-4EA9-B58F-6395012D6D83\/testproject.app\/Frame"]}, "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0}, "faultingThread" : 0, "threads" : [{"triggered":true,"id":2617499,"threadState":{"r13":{"value":140701889206256},"rax":{"value":33554953},"rflags":{"value":582},"cpu":{"value":0},"r14":{"value":1},"rsi":{"value":1},"r8":{"value":140701889205232},"cr2":{"value":4512885046},"rdx":{"value":140701889206256},"r10":{"value":242},"r9":{"value":0},"r15":{"value":6},"rbx":{"value":0},"trap":{"value":133},"err":{"value":33554953},"r11":{"value":582},"rip":{"value":4589758862,"matchesCrashFrame":1},"rbp":{"value":140701889205184},"rsp":{"value":140701889205112},"r12":{"value":242},"rcx":{"value":140701889205112},"flavor":"x86_THREAD_STATE","rdi":{"value":6}},"frames":[{"imageOffset":289166,"symbol":"__abort_with_payload","symbolLocation":10,"imageIndex":0},{"imageOffset":379506,"symbol":"abort_with_payload_wrapper_internal","symbolLocation":80,"imageIndex":0},{"imageOffset":379556,"symbol":"abort_with_payload","symbolLocation":9,"imageIndex":0},{"imageOffset":284907,"symbol":"abort_with_payload","symbolLocation":26,"imageIndex":1},{"imageOffset":21739,"symbol":"dyld4::halt(char const*)","symbolLocation":375,"imageIndex":1},{"imageOffset":7196,"symbol":"dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*)","symbolLocation":3070,"imageIndex":1},{"imageOffset":7746,"symbol":"_dyld_sim_prepare","symbolLocation":379,"imageIndex":1},{"imageOffset":27512,"symbol":"dyld4::prepareSim(dyld4::RuntimeState&, char const*)","symbolLocation":1265,"imageIndex":0},{"imageOffset":22286,"symbol":"dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*)","symbolLocation":244,"imageIndex":0},{"imageOffset":21732,"symbol":"start","symbolLocation":388,"imageIndex":0}]}], "usedImages" : [ { "source" : "P", "arch" : "x86_64", "base" : 4589469696, "size" : 442368, "uuid" : "f71fb3ca-5fcc-3577-9457-b047888a46d1", "path" : "\/usr\/lib\/dyld", "name" : "dyld" }, { "source" : "P", "arch" : "x86_64", "base" : 4512854016, "size" : 319488, "uuid" : "7276a69b-e3b9-3f23-957f-061350a501b4", "path" : "\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform\/Library\/Developer\/CoreSimulator\/Profiles\/Runtimes\/iOS.simruntime\/Contents\/Resources\/RuntimeRoot\/usr\/lib\/dyld_sim", "name" : "dyld_sim" } ], "sharedCache" : { "base" : 140733730258944, "size" : 3268706304, "uuid" : "0316ba73-5fae-3838-872d-56c53ca997ff" }, "vmSummary" : "ReadOnly portion of Libraries: Total=604.6M resident=0K(0%) swapped_out_or_unallocated=604.6M(100%)\nWritable regions: Total=10.7M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=10.7M(100%)\n\n VIRTUAL REGION \nREGION TYPE SIZE COUNT (non-coalesced) \n=========== ======= ======= \nSTACK GUARD 56.0M 1 \nStack 8192K 1 \nVM_ALLOCATE 12K 3 \n__DATA 2124K 15 \n__DATA_CONST 1149K 10 \n__LINKEDIT 559.1M 9 \n__TEXT 45.5M 15 \ndyld private memory 2048K 2 \n=========== ======= ======= \nTOTAL 673.8M 56 \n", "legacyInfo" : { "threadTriggered" : { } }, "trialInfo" : { "rollouts" : [ { "rolloutId" : "5fb4245a1bbfe8005e33a1e1", "factorPackIds" : { }, "deploymentId" : 240000015 }, { "rolloutId" : "60f8ddccefea4203d95cbeef", "factorPackIds" : { }, "deploymentId" : 240000019 } ], "experiments" : [ ] } } Model: MacBookPro16,1, BootROM 1731.140.2.0.0 (iBridge: 19.16.16066.0.0,0), 8 processors, 8-Core Intel Core i9, 2,3 GHz, 16 GB, SMC Graphics: Intel UHD Graphics 630, Intel UHD Graphics 630, Built-In Display: Color LCD, 3072 x 1920 Retina, Main, MirrorOff, Online Graphics: AMD Radeon Pro 5500M, AMD Radeon Pro 5500M, PCIe, 4 GB Memory Module: BANK 0/ChannelA-DIMM0, 8 GB, DDR4, 2667 MHz, SK Hynix, HMA81GS6CJR8N-VK Memory Module: BANK 2/ChannelB-DIMM0, 8 GB, DDR4, 2667 MHz, SK Hynix, HMA81GS6CJR8N-VK AirPort: spairport_wireless_card_type_wifi (0x14E4, 0x7BF), wl0: Jul 12 2021 18:02:56 version 9.30.464.0.32.5.76 FWID 01-c081cfed Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports Network Service: USB 10/100/1000 LAN, Ethernet, en7 Network Service: Wi-Fi, AirPort, en0 USB Device: USB31Bus USB Device: T2Bus USB Device: composite_device USB Device: Touch Bar Backlight USB Device: Touch Bar Display USB Device: Apple Internal Keyboard / Trackpad USB Device: Headset USB Device: Ambient Light Sensor USB Device: FaceTime HD Camera (Built-in) USB Device: Apple T2 Controller Thunderbolt Bus: MacBook Pro, Apple Inc., 63.5 Thunderbolt Bus: MacBook Pro, Apple Inc., 63.5 `

Version

0.70

Output of npx react-native info

System:
    OS: macOS 12.5.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 1.67 GB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 14.20.0 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 6.14.17 - /usr/local/bin/npm
    Watchman: 2022.07.04.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      API Levels: 29, 30, 31
      Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0
      System Images: android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-31 | Google APIs Intel x86 Atom_64
      Android NDK: 22.1.7171670
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.14 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0
    react-native: 0.70.0 => 0.70.0
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

just run npx react-native init testproject then cd testproject && npx react-native run-ios

Snack, code example, screenshot, or link to a repository

https://user-images.githubusercontent.com/44513402/188628441-e57b8824-ac03-4fe7-9b5e-2ed07a6e3ca1.mp4

ch3rn1k commented 2 years ago

Same

34599 #34601

Bayramito commented 2 years ago

Actually its working if i disable hermes on Podfile

Bayramito commented 2 years ago

I solved it by addinghermes.xcframework file to

xcode > build phases > Link binary with Libraries section and rebuilding the app

ch3rn1k commented 2 years ago

hermes.xcframework

Where did u get hermes.xcframework?

Bayramito commented 2 years ago

hermes.xcframework

Where did u get hermes.xcframework?

just press to + sign and search for hermes

Ekran Resmi 2022-09-07 13 59 28
ch3rn1k commented 2 years ago

hermes.xcframework

Where did u get hermes.xcframework?

just press to + sign and search for hermes

Ekran Resmi 2022-09-07 13 59 28

image

lmao

Bayramito commented 2 years ago

Temporary fix:

change highlighted area with:

Ekran Resmi 2022-09-07 15 44 59
if [[ "$CONFIGURATION" == "Debug" ]]; then
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-DoubleConversion/double-conversion.framework"
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-Glog/glog.framework"
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework"
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"
fi

DO NOT RUN POD INSTALL

just npx react-native run-ios this should solve the issue but im looking to find out why pod install doesnt add this automatically....

allemanfredi commented 2 years ago

Temporary fix:

change highlighted area with:

Ekran Resmi 2022-09-07 15 44 59
if [[ "$CONFIGURATION" == "Debug" ]]; then
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-DoubleConversion/double-conversion.framework"
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-Glog/glog.framework"
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework"
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"
fi

DO NOT RUN POD INSTALL

just npx react-native run-ios this should solve the issue but im looking to find out why pod install doesnt add this automatically....

It works on my side

thomazcapra commented 2 years ago

It woked for me, thanks.

ivangonzalezg commented 2 years ago

I created this function so you don't have to manually update the Pods frameworks file every time you run pod install

def fix_hermes(app_name)
  path = "Pods/Target Support Files/Pods-" + app_name + "/Pods-" + app_name + "-frameworks.sh"
  lines = File.readlines(path)
  lines.insert(181, '  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"'+"\n")
  lines.insert(183, 'if [[ "$CONFIGURATION" == "Release" ]]; then'+"\n")
  lines.insert(184, '  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"'+"\n")
  lines.insert(185, "fi\n")
  File.write(path, lines.join, mode: "w")
  puts "Hermes fixed"
end

Add it to you Podfile. It should look like this:

image

And finally call it from the post install script

image

app_name is the target

Bayramito commented 2 years ago

I created this function so you don't have to manually update the Pods frameworks file every time you run pod install

def fix_hermes(app_name)
  path = "Pods/Target Support Files/Pods-" + app_name + "/Pods-" + app_name + "-frameworks.sh"
  lines = File.readlines(path)
  lines.insert(181, '  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"'+"\n")
  lines.insert(183, 'if [[ "$CONFIGURATION" == "Release" ]]; then'+"\n")
  lines.insert(184, '  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"'+"\n")
  lines.insert(185, "fi\n")
  File.write(path, lines.join, mode: "w")
  puts "Hermes fixed"
end

Add it to you Podfile. It should look like this:

image

And finally call it from the post install script

image

app_name is the target

Actually you dont need to call it everytime. Xcode as a caching system to store it for the project.

brandonmoon commented 1 year ago

For those still struggling with this, I found that I needed to have CocoaPods v 1.11.2 or higher for it to work correctly.

Gnative commented 1 year ago

For those still struggling with this, I found that I needed to have CocoaPods v 1.11.2 or higher for it to work correctly.

Thanks @brandonmoon but i'm on the most recent version 1.11.3, still with this issue

kelset commented 1 year ago

As I commented here, based on the repro steps I don't get the error: https://github.com/facebook/react-native/issues/34612#issuecomment-1243574942

I'm going to close this issue unless someone can provide proper repro steps

github-actions[bot] commented 1 year ago
:warning: Missing Reproducible Example
:information_source: It looks like your issue is missing a reproducible example. Please provide a Snack or a repository that demonstrates the issue you are reporting in a minimal, complete, and reproducible manner.
Gnative commented 1 year ago

Hi @kelset The repro steps are.

npx react-native init testproject then cd testproject && npx react-native run-ios or even building with in Xcode.

And then Hermes is not included with in the build. Where we are seeing errors like

'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/hermes.framework/hermes' (no such file),

'/usr/lib/swift/hermes.framework/hermes' (no such file),

I have this also with-in my production app after upgrade from 0.69. I don't personally understand why. If it's the operating system, setup or something else.

kelset commented 1 year ago

as I have already mentioned, those repro steps don't lead to me experiencing the issue reported. So yes, it's probably something with your local setup. Please see my other comment for my configuration and try to see if there's any difference.

Gnative commented 1 year ago

Ok cool.. you are using an M1 mac and this issue has indicated that this issue is replicated-able on an Intel mac.. could this be the cause ?

 System:
    OS: macOS 12.5.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 1.67 GB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh

Other wise i'm on the same versions and have tried downgrading upgrading to see if there is a difference.

System:
    OS: macOS 12.5.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 2.14 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
    Watchman: 2022.09.05.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.14.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0
    react-native: 0.70.0 => 0.70.0
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
kelset commented 1 year ago

It's not that, I just tested on my intel machine and it also works just fine:

System:
    OS: macOS 12.5
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 39.34 GB / 64.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.15.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.11.0 - /usr/local/bin/npm
    Watchman: 2022.07.04.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /Users/lsciandra/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK:
      Android NDK: 21.4.7075529
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.14 - /Users/lsciandra/.sdkman/candidates/java/current/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0
    react-native: 0.70.0 => 0.70.0
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not FoundScreenshot 2022-09-13 at 15.23.16.png

screenshot:

unnamed

Gnative commented 1 year ago

@kelset Thanks for your help. I've created a completely fresh install with the repo instructions above. Here is a git repo to view the output

https://github.com/Gnative/reactnative-0.70.0

System:

System:
    OS: macOS 12.5.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 2.14 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.17.0 - ~/.nvm/versions/node/v16.17.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v16.17.0/bin/npm
    Watchman: 2022.09.05.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.14.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0
    react-native: 0.70.0 => 0.70.0
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
dyld[70938]: Library not loaded: @rpath/hermes.framework/hermes
  Referenced from: /Users/Gnative/Library/Developer/CoreSimulator/Devices/D82D1AD7-DCAD-4C4B-A7C2-2AD20C92B86C/data/Containers/Bundle/Application/DD542822-31A0-4F98-A1D7-3C795F33799C/test.app/test
Gnative commented 1 year ago

My Pods/Target Support Files/Pods/test/Pods-test-frameworks that missing any linkage to hermes.

#!/bin/sh
set -e
set -u
set -o pipefail

function on_error {
  echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
}
trap 'on_error $LINENO' ERR

if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
  # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
  # frameworks to, so exit 0 (signalling the script phase was successful).
  exit 0
fi

echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"

COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
BCSYMBOLMAP_DIR="BCSymbolMaps"

# This protects against multiple targets copying the same framework dependency at the same time. The solution
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")

# Copies and strips a vendored framework
install_framework()
{
  if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
    local source="${BUILT_PRODUCTS_DIR}/$1"
  elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
    local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
  elif [ -r "$1" ]; then
    local source="$1"
  fi

  local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"

  if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink "${source}")"
  fi

  if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then
    # Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied
    find "${source}/${BCSYMBOLMAP_DIR}" -name "*.bcsymbolmap"|while read f; do
      echo "Installing $f"
      install_bcsymbolmap "$f" "$destination"
      rm "$f"
    done
    rmdir "${source}/${BCSYMBOLMAP_DIR}"
  fi

  # Use filter instead of exclude so missing patterns don't throw errors.
  echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
  rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"

  local basename
  basename="$(basename -s .framework "$1")"
  binary="${destination}/${basename}.framework/${basename}"

  if ! [ -r "$binary" ]; then
    binary="${destination}/${basename}"
  elif [ -L "${binary}" ]; then
    echo "Destination binary is symlinked..."
    dirname="$(dirname "${binary}")"
    binary="${dirname}/$(readlink "${binary}")"
  fi

  # Strip invalid architectures so "fat" simulator / device frameworks work on device
  if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
    strip_invalid_archs "$binary"
  fi

  # Resign the code if required by the build settings to avoid unstable apps
  code_sign_if_enabled "${destination}/$(basename "$1")"

  # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
  if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
    local swift_runtime_libs
    swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u)
    for lib in $swift_runtime_libs; do
      echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
      rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
      code_sign_if_enabled "${destination}/${lib}"
    done
  fi
}
# Copies and strips a vendored dSYM
install_dsym() {
  local source="$1"
  warn_missing_arch=${2:-true}
  if [ -r "$source" ]; then
    # Copy the dSYM into the targets temp dir.
    echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
    rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"

    local basename
    basename="$(basename -s .dSYM "$source")"
    binary_name="$(ls "$source/Contents/Resources/DWARF")"
    binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}"

    # Strip invalid architectures from the dSYM.
    if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then
      strip_invalid_archs "$binary" "$warn_missing_arch"
    fi
    if [[ $STRIP_BINARY_RETVAL == 0 ]]; then
      # Move the stripped file into its final destination.
      echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
      rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
    else
      # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
      mkdir -p "${DWARF_DSYM_FOLDER_PATH}"
      touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM"
    fi
  fi
}

# Used as a return value for each invocation of `strip_invalid_archs` function.
STRIP_BINARY_RETVAL=0

# Strip invalid architectures
strip_invalid_archs() {
  binary="$1"
  warn_missing_arch=${2:-true}
  # Get architectures for current target binary
  binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
  # Intersect them with the architectures we are building for
  intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
  # If there are no archs supported by this binary then warn the user
  if [[ -z "$intersected_archs" ]]; then
    if [[ "$warn_missing_arch" == "true" ]]; then
      echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
    fi
    STRIP_BINARY_RETVAL=1
    return
  fi
  stripped=""
  for arch in $binary_archs; do
    if ! [[ "${ARCHS}" == *"$arch"* ]]; then
      # Strip non-valid architectures in-place
      lipo -remove "$arch" -output "$binary" "$binary"
      stripped="$stripped $arch"
    fi
  done
  if [[ "$stripped" ]]; then
    echo "Stripped $binary of architectures:$stripped"
  fi
  STRIP_BINARY_RETVAL=0
}

# Copies the bcsymbolmap files of a vendored framework
install_bcsymbolmap() {
    local bcsymbolmap_path="$1"
    local destination="${BUILT_PRODUCTS_DIR}"
    echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}""
    rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"
}

# Signs a framework with the provided identity
code_sign_if_enabled() {
  if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
    # Use the current code_sign_identity
    echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
    local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"

    if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
      code_sign_cmd="$code_sign_cmd &"
    fi
    echo "$code_sign_cmd"
    eval "$code_sign_cmd"
  fi
}

if [[ "$CONFIGURATION" == "Debug" ]]; then
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-DoubleConversion/double-conversion.framework"
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-Glog/glog.framework"
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework"
fi
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
  wait
fi
cam-shaw commented 1 year ago

@kelset I'm also getting this issue and adding hermes.xcframework to the Link Binary WIth Library build phase resolved it.

FWIW

System:
    OS: macOS 12.5.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 3.33 GB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.9.0 - ~/.nvm/versions/node/v18.9.0/bin/node
    Yarn: 1.22.11 - ~/.nvm/versions/node/v16.6.2/bin/yarn
    npm: 8.19.1 - ~/.nvm/versions/node/v18.9.0/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.3 - /Users/camerons/.gem/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8815526
    Xcode: 14.0/14A309 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.15 - /Users/camerons/homebrew/opt/openjdk@11/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.0 => 0.70.0 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
kelset commented 1 year ago

@cam-shaw it looks like you are using Xcode 14 and there's a separate issue currently open for that https://github.com/facebook/react-native/issues/34679

cipolleschi commented 1 year ago

Hi everyone, I just tried to repro this without success.

What I noticed is that I already have these lines in my

if [[ "$CONFIGURATION" == "Debug" ]]; then
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-DoubleConversion/double-conversion.framework"
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/Flipper-Glog/glog.framework"
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework"
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
  install_framework "${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/hermes.framework"
fi

in my Pods-testproject-frameworks.sh script, that are the ones that fixes the issues, as suggested here.

After a quick search in the codebase, we don't add those lines in any script, therefore it is something Cocoapods does. To me, it looks like a corrupted pod install, either something happened and the error was silenced or there is some other misconfiguration going on.

I checked the Cocoapods version and we are both on 1.11.3.

A few clarifying questions:

  1. Which version of Ruby are you using?
  2. Have you tried to do the npx react-native init testproject && cd testproject && npx react-native run-ios steps more than once?
  3. Could you try these steps, please?
    1. npx react-native init testproject --skip-install
    2. cd testproject
    3. yarn install
    4. cd ios
    5. bundle install
    6. bundle exec pod install
Gnative commented 1 year ago

Hi @cipolleschi, thank you. Tagging @kelset

First note, received an error when running bundle install which I haven't seen before

Your Ruby version is 2.6.8, but your Gemfile specified 2.7.5

This also corresponds with the .ruby-version 2.7.5 - just to note this is not the default version or ruby for Mac OSX 12.5.1.

After updating ruby to 2.7.5, using the commands below did work with the inclusion of hermes.framework, the app compiled and ran fine.

bundle install
bundle exec pod install

However.. clearing ios/Pods and then using just pod install does not work.

Also applied the above against my upgraded project 0.68.2 -> 0.70.0 and that now works as well with these commands..

Whats the next step to debug this ? reinstall cocoapods ?

cipolleschi commented 1 year ago

Ok, so it seems that the problem is with the Ruby version and how the pod are installed. Thank you for the test.

The new setup that we are going to support is the one with Ruby 2.7.5 and bundler. This will make it easier to handle the iOS dependencies in the long run.

note this is not the default version or ruby for Mac OSX 12.5.1.

Yes, we know. However, it is not a good practice to rely on the Mac OS default ruby version. There are plenty of articles online that explain why. Our suggestion is to install a Ruby version manager like RBEnv and let it manage the dependencies for you.

Bundler is an helpful way to handle ruby dependencies and make sure that everyone have the same experience. Going forward, the suggested way to install the pods will always be by using bundle exec pod install. Note that bundle install has to run only once.

Whats the next step to debug this ? reinstall cocoapods ?

Sorry, I don't understand. What do you mean? What do you want to achieve with the "next steps"?

Next steps

To improve the experience for everyone, we are going to:

  1. Improve the website documentation explaining this
  2. Update the CLI to run some of these tasks automatically. Specifically:
    1. check the Ruby version
    2. run bundle install
    3. run bundle exec pod install

Does this sound good?

Gnative commented 1 year ago

That the default installation of a react project with npx react-native init testproject fails but then running bundle exec pod install does work so i figured this entire issue was about resolving this base installation issue..

What would be the next step in debugging this, as in, I helped with your questions and offering to try anything else for you since this issue is not been able to be replicated by some people

Gnative commented 1 year ago

Thanks @cipolleschi and @kelset ..

LoknathPandit commented 1 year ago

I solved it by addinghermes.xcframework file to

xcode > build phases > Link binary with Libraries section and rebuilding the app

it worked for me

ddikodroid commented 1 year ago

anyone know which step i've missed?

Screenshot 2022-10-24 at 22 30 54
cipolleschi commented 1 year ago

@ddikodroid The problem you are facing is that React Native is using the system version while your folder is using something else. My suggestion would be to install a proper Ruby Version Manager as we suggest here. In the section: React Native CLI Quickstart/MacOS/iOS, we added some references to how to properly set up your ruby environment.

ddikodroid commented 1 year ago

@ddikodroid The problem you are facing is that React Native is using the system version while your folder is using something else. My suggestion would be to install a proper Ruby Version Manager as we suggest here. In the section: React Native CLI Quickstart/MacOS/iOS, we added some references to how to properly set up your ruby environment.

i've installed rbenv, but still encountering that problem.

but, eventhough the error appears, i'm able to run the project succesfully but executing

bundle install
cd ios && bundle exec pod install
nikpetrovic commented 1 year ago

@ddikodroid Did you find a solution? I am facing the same issue. For new projects it works fine, but for these that are using RN < 0.70.x it doesn't.

cipolleschi commented 1 year ago

@nikpetrovic can you share a screenshot with your error?

nikpetrovic commented 1 year ago

anyone know which step i've missed?

Screenshot 2022-10-24 at 22 30 54

I was getting the same error as @ddikodroid until I installed new version of cocoapods via sudo gem install cocoapods. Now i can init a brand new rn project, but when i try to run the old one:

image

after deleting node_modules and

npm install cd ios bundle install bundle exec pod install

I am getting:

image

any ideas @cipolleschi ?

ddikodroid commented 1 year ago

@ddikodroid Did you find a solution? I am facing the same issue. For new projects it works fine, but for these that are using RN < 0.70.x it doesn't.

i'm using the workaround when i create a new project with react native version 0.67.2

nikpetrovic commented 1 year ago

After hours of investigation I finally figured out what was the problem. The first part is related to upgrading to react-native 0.70.x and uprgading cocoapods via sudo gem install cocoapods. I've also configured ruby version to 2.7.5 via rbenv but not sure if this helped since I was getting the error even after upgrade. Only after sudo gem install cocoapods it disappeared.

After this I was able to do pod install but still getting the message Failed to load configuration of your project. Than I found leftover in react-native.config.js for the library I was not using anymore. After removing this configuration it started to work normally. Interestingly, I didn't get this error with 0.69.x although I didn't use this library as well. Hope someone will find this useful.

traviswimer commented 1 year ago

In case anyone needs a summary of this thread, this problem seems to be a result of version mismatches across a few possible places.

So, based on comments on this issue and other places, here are the steps I took to fix the error:

  1. Install the version of Ruby listed in the Gemfile and .ruby-version
  2. Install correct version of CocoaPods using bundle install
  3. Update the CocoaPods repo using bundle exec pod repo update
  4. Install pods with bundle exec pod install

I also made a blog post about it if you'd like more details: https://traviswimer.com/blog/cocoapods-could-not-find-compatible-versions-for-pod-hermes-engine/


If you're on an older version of React Native <0.67.0, it will not include a Gemfile, so the process will be different (and may have some issues)

  1. Upgrade Ruby to the desired version. (Ruby 2.7.4 is the version initially used in RN 0.67.0)
  2. Upgrade CocoaPods to the latest version: gem install cocoapods
  3. Update the CocoaPods repo pod repo update
  4. Delete Podfile.lock
  5. Run pod install
Gnative commented 1 year ago

@traviswimer

Thanks.. For me it was also important to use

'bundle exec pod install'

traviswimer commented 1 year ago

@Gnative That's a good point, although I'm not sure to what extent its necessary. I suppose it would depend on what a project has in its Gemfile (if it has one).

I'm not super knowledgable with Ruby, but I think using bundle exec could also cause problems if, for example, the Gemfile included an older version of CocoaPods.

Any idea why bundle exec was necessary in your case? Did you still get the same error with just pod install or was it possibly a result of some other issue caused by not using the gem versions in your Gemfile?

I may add a note about this to my post, but I'm not entirely sure what to say other than that bundle exec may be necessary in certain cases.

Gnative commented 1 year ago

@traviswimer - it's great you wrote this post and article.. thanks.

Following this comment above from @cipolleschi https://github.com/facebook/react-native/issues/34608#issuecomment-1246730507 where they say that the suggested way going forward is to use bundle install and bundle exec pod install You can read the corresponding thread above that comment between @cipolleschi and myself.

There is also this in the React Native documentation about using the Ruby Bundler - https://reactnative.dev/docs/environment-setup#bundler

I couldn't tell you why, for me, bundle exec is necessary but hermes.framework is not included in the project unless I run bundle exec pod install.

cipolleschi commented 1 year ago

Hi there! @traviswimer we decided to adopt bundle for Ruby as a measure to avoid fragmentation in the various versions of ruby and cocoapods for all our users.

Thanks to the Gemfile and the .ruby-version file, we can ensure that all the users on a given React Native version are all using the same versions of the common dependencies. In this way, we would be able to support every user more efficiently and in a more scalable way.

bundle exec will the the recommended way to install the dependencies for iOS. By using it, we can safely exclude a whole set of configuration problems. The newer version of the CLI will use bundler by default. And we have plans to upgrade the doctor command with similar checks.

I hope this can shed more light on how we would like to handle dependencies and configurations from now on. The rationale is that it should simplify the management in the long run.

traviswimer commented 1 year ago

@cipolleschi @Gnative Thanks for the clarification.

My understanding from this is that the cli now creates a Gemfile and .ruby-version at the root of the project. When you upgrade the project's version of React Native, you will need to change the versions in these files. In other words, use the React Native Upgrade Helper to determine the necessary changes and then go through all the steps to upgrade Ruby, CocoaPods, and the actual pods.

Based on this, I believe my previous conclusions were not good advice. I have updated my original comment as well as my blog post.

If any of it still sounds incorrect/misleading, I appreciate your feedback.

Thanks again!

oleksandr-dziuban commented 1 year ago

Hi guys. Once you are migrating from previous RN version to latest one (for example RN v0.70+) you just need additionally run this in ios folder:

pod update hermes-engine --no-repo-update

Sometimes pod install not installing the new hermes engine correctly. Once you done this, clean and rebuild project app is opening correctly.

If you run this command you can find this diff in Podfile.lock:

Screenshot 2022-11-28 at 21 26 10
Adnan-Bacic commented 1 year ago

i updated from 0.70.0 to 0.70.6 and it works for me now

kopax-polyconseil commented 1 year ago

I have the same issue, in GitHub action macos-12.

I solved it by addinghermes.xcframework file to

xcode > build phases > Link binary with Libraries section and rebuilding the app

This didn't work for us, in GitHub action macos-12 runner, still produce a bad build

We also use bundle , bundle install, cd ios && bundle exec pod install, we also use ruby 2.7.5 , nothing we tried work.

React Native 0.68.5, any clue how we can do ?

traviswimer commented 1 year ago

@kopax-polyconseil I'm not sure if this is the problem, but the Gemfile for 0.68.5 uses Ruby 2.7.4: https://raw.githubusercontent.com/react-native-community/rn-diff-purge/release/0.68.5/RnDiffApp/Gemfile

You might want to check your Gemfile to ensure the Ruby and CocoaPods versions listed match the versions in the the official Gemfile for react native 0.68.5.

Also, if you look at my previous comment, you'll see that you missed one step that needs to be run before installing pods: bundle exec pod repo update

It may also have something to do with the hermes.xcframework you added to Link binary with Libraries. You may have added the wrong version. Also, in the latest versions of react native the Hermes framework is added automatically, but I can't remember if 0.68.5 is before or after this change was added.

If you decide to upgrade React Native to the latest version, you shouldn't include Hermes manually.

kopax-polyconseil commented 1 year ago

If you decide to upgrade React Native to the latest version, you shouldn't include Hermes manually.

We want to upgrade react native but it can't be done prior solving our e2e env, as the upgrade for us will take some time (we already had an attempt).

Also, if you look at my https://github.com/facebook/react-native/issues/34608#issuecomment-1319114711, you'll see that you missed one step that needs to be run before installing pods: bundle exec pod repo update

I tried it, I also tried to remove the Podfile.lock, I almost tried everything, you can see it here https://github.com/pass-culture/pass-culture-app-native/actions/workflows/e2e-ios-app.yml , because it takes 2 hours, I try a lot of thing per attempt to fix and none of them work.

This is the pull request I work on to try to fix: https://github.com/pass-culture/pass-culture-app-native/pull/3996

It may also have something to do with the hermes.xcframework you added to Link binary with Libraries

It was not in here, I tried to add it after reading this topic, it didn't helped, I then tried to do the second advice here: https://github.com/facebook/react-native/issues/34601#issuecomment-1239398489 , then it said:

❌  error: Multiple commands produce '/Users/runner/Library/Developer/Xcode/DerivedData/PassCulture-azrmecqxadxqrlcfhryqxqnufohv/Build/Products/Release-iphonesimulator/PassCulture.app/Frameworks/hermes.framework'

Since it got added twice and build failed, we only kept the second option, it also didn't work, but this time I don't have a bug report log like I had before (exemple here)

Also, I am not sure if it should work for our version. This problem we only have it in GitHub action, in Circle CI we do not have it, and locally also it work fine.

I also tried without success to:

What else can I try ?

traviswimer commented 1 year ago

@kopax-polyconseil Since the problem is only on Github Actions, I'd probably look into whether it's caching anything from previous runs. If DerivedData, your ios/build folder, or node_modules are persisting between builds, I imagine that has the potential to cause some problems.

I'm not all that knowledgable on Github Actions, but if its possible that caching is the issue, you could try creating another simpler action just to test if making a fresh build fixes the error.

kopax-polyconseil commented 1 year ago

you could try creating another simpler action just to test if making a fresh build fixes the error.

I already tried it and it didn't work. We will have to try to upgrade to React Native and pray :)