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

执行eas build --platform ios时Metro报错:Cannot read properties of undefined (reading 'transformFile')

iOS Expo构建失败:Metro报错Cannot read properties of undefined (reading 'transformFile')

执行eas build --platform ios构建Expo Go应用时,在「Run fastlane」阶段失败,核心报错如下:

❌ Metro encountered an error:
Cannot read properties of undefined (reading 'transformFile')

完整构建日志:

› Compiling expo-constants Pods/EXConstants » EXConstants_vers.c
› Compiling expo-constants Pods/EXConstants » EXConstantsService.m
› Compiling expo-constants Pods/EXConstants » EXConstantsInstallationIdProvider.m
› Compiling expo-constants Pods/EXConstants » EXConstants-dummy.m
› Creating  Bui
› Compiling expo-dev-menu Pods/expo-dev-menu » expo-dev-menu-dummy.m
› Compiling expo-dev-menu Pods/expo-dev-menu » EXDevMenu_vers.c
› Compiling expo-dev-menu Pods/expo-dev-menu » EXDevMenuAppInfo.m
› Compiling expo-dev-menu Pods/expo-dev-menu » DevMenuRootView.m
› Compiling expo-dev-menu Pods/expo-dev-menu » DevMenuRCTDevSettings.m
› Compiling expo-dev-menu Pods/expo-dev-menu » DevMenuRCTBridge.mm
› Compiling expo-dev-menu Pods/expo-dev-menu » DevMenuLoadingView.m
⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » Wibet/Wibet » Build Phases » 'Start Packager'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » Wibet/Wibet » Build Phases » 'Bundle React Native code and images'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » Wibet/Wibet » Build Phases » '[CP-User] [RNFB] Core Configuration'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » Pods/abseil » Build Phases » 'Create Symlinks to Header Folders'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸   PhaseScriptExecution [CP-User]\ Generate\ app.manifest\ for\ expo-updates /Users/expo/Library/Developer/Xcode/DerivedData/Wibet-fjxowylqaoovhbfcvrpmgwrqngkm/Build/Intermediates.noindex/ArchiveIntermediates/Wibet/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/EXUpdates.build/Script-46EB2E0005E760.sh (in target 'EXUpdates' from project 'Pods')
▸ (1 failure)
2024-04-02 10:33:31.054 xcodebuild[45749:54455] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
** ARCHIVE FAILED **
The following build commands failed:
    PhaseScriptExecution [CP-User]\ Generate\ app.manifest\ for\ expo-updates /Users/expo/Library/Developer/Xcode/DerivedData/Wibet-fjxowylqaoovhbfcvrpmgwrqngkm/Build/Intermediates.noindex/ArchiveIntermediates/Wibet/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/EXUpdates.build/Script-46EB2E0005E760.sh (in target 'EXUpdates' from project 'Pods')
(1 failure)

Exit status: 65

已尝试的解决方案

  • 切换Node LTS版本:试过14.x、16.x、18.x、20.x,每次切换后删除node_modules并重新执行npm install
  • 确认ios/.xcode.env.local中export的Node版本正确
  • 尝试过SSL连接方案

系统配置

System:
  OS: macOS 14.1.1
  CPU: (8) arm64 Apple M1
  Memory: 328.97 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.17.1
    path: ~/.nvm/versions/node/v18.17.1/bin/node
  Yarn:
    version: 1.22.21
    path: /opt/homebrew/bin/yarn
  npm:
    version: 9.6.7
    path: ~/.nvm/versions/node/v18.17.1/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 20.0.1
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 13.6.4
    wanted: ^13.6.4
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.10
    wanted: 0.72.10
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: false
  newArchEnabled: false

配置文件

metro.config.js

const { getDefaultConfig } = require('expo/metro-config');

/** @type {import('expo/metro-config').MetroConfig} */
const defaultConfig = getDefaultConfig(__dirname);
defaultConfig.resolver.assetExts.push('cjs');

module.exports = defaultConfig;

babel.config.js

module.exports = function (api) {
  api.cache(true);
  return {
    presets: ["babel-preset-expo"],
    plugins: [
      "@babel/plugin-proposal-export-namespace-from",
      "react-native-reanimated/plugin",
      require.resolve("expo-router/babel"),
    ],
  };
};

求提供解决思路,非常感谢!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 10:42:14