使用expo-router时EAS Build构建Android APK卡在“Bundle JS (0/1)”步骤无进展的问题排查求助
expo-router时EAS Build构建Android APK卡在“Bundle JS (0/1)”步骤无进展的问题排查求助
各位好,我现在遇到一个棘手的问题:在使用EAS Build为Expo + React Native项目构建Android APK时,构建过程会一直卡在「Bundle JS」步骤(显示0/1),完全没有进展也不抛出错误。本地运行一切正常,但CI构建就是卡在这里,麻烦大家帮忙看看可能的原因和解决办法。
问题描述
我执行的构建命令是:
eas build -p android --profile apk
构建流程在依赖安装、prebuild等步骤都能正常推进,但到了「Bundle JS」阶段就彻底停滞,日志停留在:
bundling: Starting Metro Bundler Android node_modules/expo-router/entry.js ░░░░░░░░░░░░░░░░ 0.0% (0/1)
没有任何错误日志输出,也不会超时失败,就一直挂在这个状态。
但项目在以下环境下运行完全正常:
- Android模拟器(
expo run:android启动) - Expo Go客户端
npx expo-doctor检测未报告任何问题
环境信息
- Expo SDK: 54
- expo-router: ~6.0.21
- React Native: 0.81.5
- 已启用新架构(New Architecture)
- EAS CLI: >= 16.28.0
- 目标平台:Android(APK构建)
相关配置文件
package.json
{ "name": "app", "version": "1.0.1", "main": "expo-router/entry", "scripts": { "start": "expo start", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web", "test": "jest --coverage", "bundle": "expo export --platform android" }, "dependencies": { "@expo/metro-runtime": "~6.1.2", "@react-native-async-storage/async-storage": "2.2.0", "@react-native-community/datetimepicker": "8.4.4", "@react-navigation/native": "^7.1.8", "@sentry/react-native": "~7.2.0", "expo": "^54.0.30", "expo-constants": "~18.0.12", "expo-image-picker": "~17.0.10", "expo-linking": "~8.0.11", "expo-notifications": "~0.32.15", "expo-router": "~6.0.21", "expo-secure-store": "~15.0.8", "expo-status-bar": "~3.0.9", "expo-system-ui": "~6.0.9", "expo-updates": "~29.0.15", "expo-web-browser": "~15.0.10", "jwt-decode": "^4.0.0", "nativewind": "^4.2.1", "react": "19.1.0", "react-dom": "19.1.0", "react-native": "0.81.5", "react-native-dropdown-picker": "^5.4.6", "react-native-elements": "^3.4.3", "react-native-gesture-handler": "~2.28.0", "react-native-keyboard-aware-scroll-view": "^0.9.5", "react-native-pager-view": "6.9.1", "react-native-reanimated": "~4.1.1", "react-native-safe-area-context": "~5.6.0", "react-native-screens": "~4.16.0", "react-native-tab-view": "^4.2.2", "react-native-web": "^0.21.0", "react-native-worklets": "0.5.1", "react-native-worklets-core": "^1.6.2", "tailwindcss": "^3.4.15", "zod": "^3.23.8", "zustand": "^5.0.0" }, "devDependencies": { "@babel/core": "^7.25.2", "@types/react": "~19.1.0", "jest": "^29.7.0", "jest-expo": "~54.0.16", "typescript": "~5.9.2" }, "private": true, "extra": { "expoClient": { "hostType": "lan" } } }
metro.config.js
const { getDefaultConfig } = require('expo/metro-config'); const { withNativeWind } = require('nativewind/metro'); const config = getDefaultConfig(__dirname); config.watchFolders = []; config.server = { enhanceMiddleware: (middleware) => middleware, }; module.exports = withNativeWind(config, { input: './global.css' });
eas.json
{ "cli": { "version": ">= 16.28.0", "appVersionSource": "remote" }, "build": { "development": { "developmentClient": true, "distribution": "internal", "channel": "development", "env": { "EXPO_PUBLIC_API_URL": "HIDDEN" } }, "preview": { "distribution": "internal", "channel": "preview" }, "apk": { "android": { "buildType": "apk" }, "cache": { "disabled": false }, "channel": "production", "env": { "EXPO_PUBLIC_API_URL": "HIDDEN", "EXPO_NO_METRO_WATCHER": "1", "CI": "true" } }, "production": { "android": { "buildType": "apk" }, "channel": "production", "cache": { "disabled": false }, "env": { "EXPO_NO_METRO_WATCHER": "1", "CI": "true" } } }, "submit": { "production": {} } }
app.json
{ "expo": { "name": "App", "slug": "App", "scheme": "myapp", "version": "1.0.1", "orientation": "portrait", "icon": "./assets/icon.png", "userInterfaceStyle": "light", "newArchEnabled": true, "splash": { "image": "./assets/splash-icon.png", "resizeMode": "contain", "backgroundColor": "#ffffff" }, "ios": { "supportsTablet": true, "bundleIdentifier": "com.yourname.app" }, "android": { "package": "com.yourname.app", "adaptiveIcon": { "foregroundImage": "./assets/adaptive-icon.png", "backgroundColor": "#ffffff" }, "edgeToEdgeEnabled": true, "predictiveBackGestureEnabled": false }, "web": { "favicon": "./assets/favicon.png" }, "extra": { "eas": { "projectId": "HIDDEN", "apiUrl": "process.env.EXPO_PUBLIC_API_URL" } }, "updates": { "enabled": false }, "runtimeVersion": { "policy": "appVersion" }, "plugins": [ //"expo-font", "expo-router" // "@sentry/react-native", ] } }
已尝试的解决方法
- 运行
npx expo-doctor,未检测到任何问题 - 清理本地缓存和EAS构建缓存后重新构建
- 在eas.json中添加
EXPO_NO_METRO_WATCHER=1环境变量,禁用Metro监听器 - 确认项目在Android模拟器、Expo Go中运行完全正常
- 调整metro.config.js的配置(比如修改
watchFolders、server设置) - 移除项目中无关的依赖包,尝试重新构建(无效果)
核心疑问
- 为什么项目在本地运行一切正常,但EAS Build构建Android APK时会卡在「Bundle JS (0/1)」步骤?
- 这个问题是否与以下因素相关的已知问题:
- Expo SDK 54
- 新架构(New Architecture)启用
- expo-router的使用
- CI/EAS环境下的Metro bundler行为
- 有没有针对该问题的已知修复方案或排查方向?
麻烦各位大佬帮忙分析一下,非常感谢!




