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

Expo-React-Native+Next.js集成next-images后构建报错:图片导入无效

Expo + Next.js 项目配置next-images后仍无法构建,图片导入报错

按照文档安装并配置next-images插件后,我的Expo-React-Native+Next.js项目仍无法正常构建,构建时出现7次相同错误:Error: Image import "./assets/X.png" is not a valid image file. The image may be corrupted or an unsupported format.,该错误不仅出现在自有代码中,还存在于已安装的react-navigation等依赖包内。

环境信息

expo-env-info 1.0.5 environment info:
System:
OS: Linux 5.15 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
Shell: 5.1.4 - /bin/bash
Binaries:
Node: 16.17.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.15.0 - /usr/local/bin/npm
Watchman: 20220528.183901.0 - /usr/local/bin/watchman
npmPackages:
expo: ^47.0.0 => 47.0.8
react: 18.1.0 => 18.1.0
react-dom: 18.1.0 => 18.1.0
react-native: 0.70.5 => 0.70.5
react-native-web: ~0.18.7 => 0.18.10

Expo Workflow: managed

错误示例

@react-navigation/elements:154 Error: Image import "./assets/back-icon-mask.png" is not a valid image file. The image may be corrupted or an unsupported format.
./AppbarBackIcon:66 Error: Image import "../../assets/back-chevron.png" is not a valid image file. The image may be corrupted or an unsupported format.

其余错误类似。

复现步骤

使用复现项目,进入项目目录后执行以下命令:

cd north-sea-native-next/north-sea/next && yarn next dev

等待页面构建即可触发错误。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.08 12:25:14