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

Expo SDK52安卓模拟器报错:找不到InternalBytecode.js文件

Expo SDK 52 安卓模拟器 ENOENT 错误(找不到 InternalBytecode.js)解决方案

问题详情

运行环境:Expo SDK 52 + JDK 17 + 安卓模拟器
核心错误:

ERROR  Warning: TypeError: Cannot read property 'regular' of undefined

Error: ENOENT: no such file or directory, open 'C:\CeSolutions\iSuite_Pro\InternalBytecode.js'
    at Object.readFileSync (node:fs:441:20)
    at getCodeFrame (C:\CeSolutions\iSuite_Pro\node_modules\metro\src\Server.js:949:18)
    at Server._symbolicate (C:\CeSolutions\iSuite_Pro\node_modules\metro\src\Server.js:1026:22)
    at Server._processRequest (C:\CeSolutions\iSuite_Pro\node_modules\metro\src\Server.js:419:7) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\CeSolutions\\iSuite_Pro\\InternalBytecode.js'
}

expo-doctor检查无异常,但仅安卓模拟器安装应用时出错,Expo Go、预构建/构建均正常。

解决步骤

  1. 彻底清理 Metro 缓存
    执行命令清除缓存并重启开发服务器:

    npx expo start --clear
    

    若无效,手动删除缓存目录后重装依赖:

    rm -rf .expo node_modules/.cache
    npm install
    
  2. 重置安卓模拟器状态

    • 进入模拟器设置>系统>重置>清除所有数据(恢复出厂设置)
    • 卸载模拟器上已安装的目标应用,重新执行npx expo run:android
  3. 调整 Metro 配置
    在项目根目录metro.config.js中添加过滤规则,避免Metro扫描不存在的文件:

    const { getDefaultConfig } = require('expo/metro-config');
    const config = getDefaultConfig(__dirname);
    
    // 排除无效路径扫描
    config.watchFolders = config.watchFolders.filter(folder => !folder.includes('InternalBytecode'));
    config.resolver.sourceExts.push('cjs');
    
    module.exports = config;
    
  4. 清理安卓构建产物
    删除旧构建文件后重新预构建:

    rm -rf android/build
    npx expo prebuild --clean
    npx expo run:android
    
  5. 切换 Node.js 版本
    切换至 Expo SDK 52 推荐的 Node.js 18.x 版本(使用nvm管理版本):

    nvm install 18
    nvm use 18
    npm install
    

验证

完成上述操作后,运行npx expo doctor确认项目配置无问题,再启动模拟器测试应用。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.15 20:23:11