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

Expo(React Native)生产环境执行expo start --no-dev -c时资源加载失败求助

Expo生产环境启动时iOS/Android均报"Failed to load all assets"错误排查思路

执行expo start --no-dev -c启动生产环境时,iOS和Android端均出现Failed to load all assets错误。已尝试清理npm缓存、Metro打包器缓存,论坛及Expo Discord社区未找到有效方案,以下是针对性排查思路:

Failed to load all assets错误截图

项目package.json依赖配置如下:

"dependencies": {
    "@react-native-async-storage/async-storage": "~1.17.3",
    "@react-native-community/datetimepicker": "6.1.2",
    "@react-native-community/netinfo": "8.2.0",
    "@react-native-masked-view/masked-view": "0.2.6",
    "@react-navigation/bottom-tabs": "^5.11.15",
    "@react-navigation/drawer": "^5.12.9",
    "@react-navigation/native": "^5.9.8",
    "@react-navigation/stack": "^5.14.9",
    "@reduxjs/toolkit": "^1.7.2",
    "date-fns": "^2.23.0",
    "expo": "^45.0.0",
    "expo-camera": "~12.2.0",
    "expo-dev-client": "~1.0.1",
    "expo-device": "~4.2.0",
    "expo-document-picker": "~10.2.1",
    "expo-file-system": "~14.0.0",
    "expo-font": "~10.1.0",
    "expo-image-picker": "~13.1.1",
    "expo-location": "~14.2.2",
    "expo-notifications": "~0.15.4",
    "expo-splash-screen": "~0.15.1",
    "expo-status-bar": "~1.3.0",
    "expo-updates": "~0.13.3",
    "formik": "^2.2.9",
    "just-clone": "^3.2.1",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.68.2",
    "react-native-calendars": "^1.1266.0",
    "react-native-gesture-handler": "~2.2.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.4",
    "react-native-pager-view": "5.4.15",
    "react-native-popup-menu": "^0.15.11",
    "react-native-reanimated": "~2.8.0",
    "react-native-root-toast": "^3.4.0",
    "react-native-safe-area-context": "4.2.4",
    "react-native-screens": "~3.11.1",
    "react-native-svg": "12.3.0",
    "react-native-tab-view": "^2.16.0",
    "react-native-timeline-feed": "^2.0.0",
    "react-native-web": "0.17.7",
    "react-native-webview": "11.18.1",
    "react-redux": "^7.2.6",
    "uuid": "^8.3.2",
    "victory-native": "^35.5.4",
    "yup": "^0.32.9"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "babel-jest": "^25.2.6",
    "eslint": "^7.32.0",
    "eslint-plugin-react": "^7.25.1",
    "eslint-plugin-react-hooks": "^4.2.0",
    "eslint-plugin-react-native": "^3.11.0",
    "jest": "^26.6.3",
    "react-test-renderer": "17.0.1",
    "reactotron-react-native": "^5.0.0",
    "reactotron-redux": "^3.1.3"
  }

排查解决思路

  • 检查资源引用路径:确认项目内所有本地资源(字体、图片、SVG等)的引用路径是否正确,注意iOS对路径大小写敏感,避免出现大小写不匹配或引用不存在文件的情况。
  • 验证expo-font配置:如果使用自定义字体,检查expo-font的加载逻辑,确保字体文件路径正确,Font.loadAsync中注册的名称与实际引用一致,同时确认字体格式(如.ttf、.otf)是否被Expo支持。
  • 排查第三方库资源冲突:部分第三方库可能自带资源文件,尝试临时移除非核心库(如victory-native、react-native-timeline-feed),重新打包测试,定位是否由特定库的资源导致加载失败。
  • 检查expo-updates配置:若启用expo-updates,确认app.json中updates字段的assetBundlePatterns是否覆盖所有需要打包的资源路径,建议设置为["**/*"]确保包含全部资源。
  • 重新生成原生项目文件:执行expo prebuild --clean清理并重新生成原生项目文件,避免原生端资源缓存或配置异常导致的问题。
  • 查看详细错误日志:启动时添加--verbose参数,即expo start --no-dev -c --verbose,通过详细日志定位具体是哪项资源加载失败,精准排查问题。
  • 检查文件权限:确认项目内所有资源文件的权限设置正常,无系统或工具标记的不可读取限制。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.25 01:39:18