If you have recently tried creating a new React Native project or updating an existing one, you may have run into some errors using the Hermes engine on iOS:
Fetching podspec for `hermes-engine` from `../node_modules/react-native/sdks/hermes/hermes-engine.podspec`[!] CocoaPods could not find compatible versions for pod "hermes-engine":
The reason you're seeing this is likely because each release of React Native now depends on specific versions of Ruby and CocoaPods.
Luckily the maintainers have also added a system to easily ensure you are using the correct versions:
1. Install the correct version of Ruby
To find the correct version of Ruby to use, navigate to the root directory of your project and open
In this file you will see a line that looks something like this:
This is the Ruby version number that your project's version of React Native requires.
To install this version of Ruby, you have a few options. You can use any installation option in the Ruby Documentation, but it is recommended that you use rbenv or RVM. These are version managers that allow you to easily switch between different versions of Ruby, which will be helpful for React Native upgrades or working with multiple RN projects.
Once you have installed Ruby, make sure the correct version of Ruby is added to your
PATH before continuing with the next steps. You can check this by running
ruby --version and ensuring it matches the version in your
2. Upgrade CocoaPods
Now that you have the latest version of Ruby, you can easily upgrade CocoaPods by navigating to your project root and running the following command:
This will automatically install the version of the CocoaPods gem listed in your
3. Update CocoaPod pods
First ensure CocoaPods has an up-to-date list of dependency releases by running the following command:
bundle exec pod repo update
Now install the pods by navigating to your
ios directory and running this command:
bundle exec pod install
If this doesn't work, you may need to delete
ios/Podfile.lock before and then rerun this command.
Now your iOS build should correctly load Hermes without any errors.