You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行pod install时expo-modules-core无podspec文件报错(SDK41)

问题描述

运行pod install时触发以下错误:

[!] No podspec found for "" in node_modules/expo-modules-core/ios

当前使用Expo SDK 41,因项目限制无法升级SDK,已尝试重新安装node_modules、删除Pods文件夹后重装,问题未解决。Podfile内容如下:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '11.0'

target 'myProject' do
  use_unimodules!
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!({ 'Flipper' => '0.87.0', 'Flipper-Folly' => '2.5.3', 'Flipper-RSocket' => '1.3.1'})
  post_integrate do |installer|
    begin
      expo_patch_react_imports!(installer)
    rescue => e
      Pod::UI.warn e
    end
  end
end

解决方案

1. 锁定expo-modules-core的兼容版本

SDK 41对应的expo-modules-core稳定版本为~0.5.1,在package.json中明确指定该版本,避免安装不兼容的高版本:

"dependencies": {
  // 保留其他原有依赖
  "expo-modules-core": "~0.5.1"
}

执行依赖安装:

npm install
# 或使用 yarn install

2. 调整Podfile的unimodules配置

修改Podfile中的use_unimodules!调用,指定模块路径,确保CocoaPods能正确识别expo-modules-core的podspec:

use_unimodules!({
  modules_paths: [
    '../node_modules/expo-modules-core',
    '../node_modules/react-native-unimodules'
  ]
})

3. 彻底清理后重装Pods

执行以下命令清理全部缓存和旧文件,再重新安装:

# 删除依赖文件和锁文件
rm -rf node_modules package-lock.json yarn.lock
# 重装npm依赖
npm install
# 进入iOS项目目录
cd ios
# 删除Pods、锁文件和CocoaPods缓存
rm -rf Pods Podfile.lock
pod cache clean --all
# 重新安装Pods
pod install

4. 检查podspec文件是否存在

若上述步骤无效,手动检查node_modules/expo-modules-core/ios目录下是否存在EXModulesCore.podspec(SDK41版本的podspec文件名为此,而非expo-modules-core.podspec)。如果不存在,删除该模块后重新安装:

rm -rf node_modules/expo-modules-core
npm install

内容的提问来源于stack exchange,提问作者coder03

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 11:02:39