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

修改Android版本信息后React Native Metro报错‘Failed to construct transformer’求助

Fixing "Failed to construct transformer: Error: Call retries were exceeded" in React Native

Hey there, sorry to hear you ran into this frustrating hiccup after tweaking your Android version code/name. The good news is this error almost never ties directly to those version changes—it’s just a timing coincidence. Let’s walk through some tried-and-true fixes to get your Metro server back up and running smoothly:

  • Reset Metro’s cache completely
    Corrupted cache is the #1 culprit here. Skip the basic restart and run this command to wipe Metro’s cache entirely:

    npx react-native start --reset-cache
    

    This forces Metro to rebuild all its transformers from scratch, which often resolves the "call retries exceeded" error right away.

  • Free up Metro’s default port (8081)
    Sometimes a leftover process or another app is hogging the port Metro uses. Here’s how to kill it:

    • On Windows:
      netstat -ano | findstr :8081
      taskkill /PID <your-process-ID> /F
      
    • On Mac/Linux:
      lsof -ti:8081 | xargs kill -9
      

    After freeing the port, restart Metro with npx react-native start.

  • Clean Android build artifacts
    Since you modified Android config files, leftover build cache might be causing unexpected conflicts. Head into your android folder and run:

    • Windows: gradlew clean
    • Mac/Linux: ./gradlew clean
      Then return to your project root and restart your app.
  • Check Node.js version compatibility
    The jest-worker error often pops up if your Node.js version clashes with your React Native/Metro setup. Use a version manager like nvm to switch to a stable, recommended version (16.x or 18.x work for most recent RN projects):

    nvm use 18
    rm -rf node_modules yarn.lock
    yarn install
    
  • Resolve dependency lock file conflicts
    Mismatched versions of jest-worker in your lock file can cause hidden issues. Back up your yarn.lock or package-lock.json, delete it, then reinstall dependencies fresh:

    rm yarn.lock
    yarn install
    

If none of these work, try deleting the hidden .metro-cache folder in your project root, then restart Metro again. Most folks fix this with the first or second step, so start there!

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.30 06:18:11