解决CocoaPods could not find compatible versions for pod "React/Core"

时间:2021-12-04 16:46:56

react-native框架中,在ios文件夹下执行pod install命令时出现的问题。

下面时完整的异常信息:

[!] CocoaPods could not find compatible versions for pod "React/Core":
In Podfile:
react-native-fetch-blob (from `../node_modules/react-native-fetch-blob`) was resolved to 0.10., which depends on
React/Core None of your spec sources contain a spec satisfying the dependency: `React/Core`. You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile. [!] use_native_modules! skipped the react-native dependency 'react-native-imui'. No podspec file was found.
- Check to see if there is an updated version that contains the necessary podspec file
- Contact the library maintainers or send them a PR to add a podspec. The react-native-webview podspec is a good example of a package.json driven podspec. See
https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec
- If necessary, you can disable autolinking for the dependency and link it manually. See
https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library

可将目录切换到工程根目录后,执行以下命令即可解决问题:

 grep -rl "s.dependency 'React/Core'" node_modules/ | xargs sed -i '' 's=React/Core=React-Core=g'

解决思路来自:https://*.com/questions/58305191/react-native-fetch-blob-issue-pod-not-installing-for-ios