'Library not loaded: @rpath/hermes.framework/hermes
I have enabled Hermes in my react-native(v0.64) Application. Everytime I run app I get following stack trace.
dyld: dyld cache load error: shared cache file open() failed
dyld: Library not loaded: @rpath/hermes.framework/hermes
Referenced from: /Users/sharktank/Library/Developer/CoreSimulator/Devices/A32F4931-51A8-4D22-AEFB-625F834CE221/data/Containers/Bundle/Application/71773888-08D5-4B82-9545-07F6B1538864/COSPM-DEV.app/COSPM-DEV
Reason: image not found
dyld: launch, loading dependent libraries
DYLD_SHARED_CACHE_DIR=/Users/sharktank/Library/Developer/CoreSimulator/Caches/dyld/20E232/com.apple.CoreSimulator.SimRuntime.iOS-14-4.18D46
DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
DYLD_LIBRARY_PATH=/Users/sharktank/Library/Developer/Xcode/DerivedData/COSPM-atbujvbobdbyehckyoqrdgmqiubm/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSim
(lldb)
I have enabled hermes in Podfile and after pod install pod is available in Pods folder. Project is in monorepo architecture along side another projects. Another app enabled with Hermes in same mono-repo package is working fine without crash.
Podfile:
require_relative '../../../node_modules/react-native/scripts/react_native_pods'
require_relative '../../../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'COSPM' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => true
)
pod 'RNVectorIcons', :path => '../../../node_modules/react-native-vector-icons'
# Firebase
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/Messaging'
pod 'CodePush', :path => '../../../node_modules/react-native-code-push'
target 'COSPMTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
end
end
I am using Xcode 12.4.
Solutions I tried which did not work:
- Clean Pods and npm packages, clean previous build and rebuild
- Clear watchman and metro bundler cache and rebuild
Solution 1:[1]
Try following:
- Change
hermes_enabled
value from true to false in Podfile - Reinstall npm/yarn dependencies by (yarn install)
- Reinstall pods (cd ios && pods install)
- Run app (react-native run-ios)
I tried this a couple of times changing hermes_enabled from true to false and back, and once it starts working.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | STAVROGYN |