React Native 0.66.3执行pod install时无法找到ReactCommon/turbomodule/core依赖的问题求助
React Native 0.66.3执行pod install时无法找到ReactCommon/turbomodule/core依赖的问题求助
我最近在用React Native 0.66.3版本开发项目,执行pod install --repo-update命令时遇到了依赖缺失的错误,具体报错如下:
ios % pod install --repo-update Auto-linking React Native modules for target `Mshika`: RNCAsyncStorage, RNCMaskedView, RNCPushNotificationIOS, RNDateTimePicker, RNDeviceInfo, RNGestureHandler, RNReanimated, RNSVG, RNScreens, RNSnackbar, RNVectorIcons, ReactNativeART, react-native-camera, react-native-document-picker, react-native-geolocation-service, react-native-image-picker, react-native-keep-awake, react-native-netinfo, react-native-restart, react-native-safe-area-context, and react-native-text-input-mask Updating local specs repositories Analyzing dependencies Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec` Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec` [!] Unable to find a specification for `ReactCommon/turbomodule/core (= 0.66.3)` depended upon by `React-RCTBlob` You have either: * mistyped the name or version. * not added the source repo that hosts the Podspec to your Podfile.
我检查了本地的node_modules文件夹,确实找不到ReactCommon/turbomodule/core这个模块,有没有大佬遇到过类似的问题,求指点一下解决办法!
解决方案:
别着急,我之前也碰到过这个问题,给你几个亲测有效的解决思路:
彻底清理依赖缓存后重装
这是解决依赖不完整问题的常用操作,步骤如下:- 回到项目根目录,删除
node_modules文件夹:rm -rf node_modules - 清除npm缓存(如果用yarn就执行
yarn cache clean):npm cache clean --force - 重新安装项目依赖:
npm install - 进入ios目录,删除
Podfile.lock和Pods文件夹:rm -rf Podfile.lock Pods - 最后再执行
pod install --repo-update试试
- 回到项目根目录,删除
检查Podfile配置是否正确
React Native 0.66版本对Podfile有特定配置要求,确保你的Podfile顶部包含这两行:require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'并且在target代码块内正确调用了
use_react_native!方法,补充缺失的配置后重新执行pod安装。手动修复React Native包
如果上面的方法都无效,可能是react-native包安装不完整,你可以尝试重新安装指定版本:npm install react-native@0.66.3 --force安装完成后去
node_modules/react-native/ReactCommon目录下确认turbomodule/core是否存在,若存在再重新执行pod操作即可。
备注:内容来源于stack exchange,提问作者dice
相关产品推荐
相关产品推荐

