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

使用Expo构建React Native APK时遇npm ERR! could not determine executable to run错误

解决npm ERR! could not determine executable to run错误的方案
  • 指定EAS CLI版本执行
    直接指定最新版EAS CLI运行命令,规避版本匹配问题:

    npx eas-cli@latest build -p android --profile preview
    
  • 本地/全局安装EAS CLI
    避免npx的动态查找问题,直接安装EAS CLI后执行命令:

    • 全局安装:
      npm install -g eas-cli
      
      安装完成后直接运行:
      eas build -p android --profile preview
      
    • 项目本地安装(推荐):
      npm install eas-cli --save-dev
      
      在项目package.json的scripts中添加命令:
      "scripts": {
        "build:android:preview": "eas build -p android --profile preview"
      }
      
      之后通过npm脚本执行:
      npm run build:android:preview
      
  • 校验EAS CLI版本兼容性
    你的eas.json要求CLI版本>= 0.52.0,先检查当前版本:

    eas --version
    

    若版本不达标,更新到符合要求的版本:

    npm update -g eas-cli
    
  • 清理缓存并重装依赖
    彻底清理缓存和项目依赖后重新安装:

    npm cache clean --force
    rm -rf node_modules package-lock.json
    npm install
    
  • 重置npx缓存
    若npx本身存在缓存异常,执行:

    npx clear-npx-cache
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.11 09:42:09