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

Expo项目构建报错:不支持MIME类型image/webp求排查

Expo iOS/Android构建报错:Unsupported MIME type: image/webp问题分析

项目依赖版本

"expo": "^50.0.0",
"react": "18.2.0",
"react-native": "0.73.6"

iOS构建报错详情

- Creating native directory (./ios)
✔ Created native directory
- Updating package.json
✔ Updated package.json
- Running prebuild
✖ Prebuild failed
Error: [ios.dangerous]: withIosDangerousBaseMod: Unsupported MIME type: image/webp
Error: [ios.dangerous]: withIosDangerousBaseMod: Unsupported MIME type: image/webp
    at Jimp.throwError (/Users/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:833)
    at Jimp.parseBitmap (/Users/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:125733)
    at Jimp.parseBitmap (/Users/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:8514)
    at /Users/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:7613
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
npx expo prebuild --no-install --platform ios exited with non-zero code: 1

Android构建报错详情

- Creating native directory (./android)
✔ Created native directory
- Updating package.json
✔ Updated package.json
- Running prebuild
✖ Prebuild failed
Error: [android.dangerous]: withAndroidDangerousBaseMod: Unsupported MIME type: image/webp
Error: [android.dangerous]: withAndroidDangerousBaseMod: Unsupported MIME type: image/webp
    at Jimp.throwError (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:833)
    at Jimp.parseBitmap (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:125733)
    at Jimp.parseBitmap (/home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:8514)
    at /home/expo/workingdir/build/node_modules/jimp-compact/dist/jimp.js:1:7613
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
npx expo prebuild --no-install --platform android exited with non-zero code: 1

可能原因分析

  • 第三方依赖暗藏WEBP资源:你自己没使用WEBP文件,但项目依赖的第三方库(比如UI组件、图标库)可能内置了WEBP格式图片。prebuild过程中jimp-compact会处理这些资源,而它本身不支持WEBP解析,因此触发报错。
  • 缓存残留:本地构建缓存里可能留存了之前临时引入的WEBP文件,清理缓存后重新构建可排查此问题。
  • 配置文件错误引用:检查app.json或app.config.js中的图标、启动图配置,确认是否意外指向了WEBP格式的资源(比如路径配置错误,关联了其他项目的WEBP文件)。
  • 工具链兼容性问题:Expo 50版本与jimp-compact的适配可能存在缺陷,导致对图片格式的识别出现异常。

内容的提问来源于stack exchange,提问作者Uğurcan

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 01:52:04