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

Expo Prebuild失败报错:paths[1]需为字符串,收到Object实例

Expo Prebuild 报错与字体加载问题

预构建报错详情

执行npx expo prebuild时触发以下错误:

C:\Users\spippolator\React\myApp> npx expo prebuild
(node:25332) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
√ Created native directory | reusing /android
√ Updated package.json | no changes
× Prebuild failed
TypeError [ERR_INVALID_ARG_TYPE]: [android.dangerous]: withAndroidDangerousBaseMod: The "paths[1]" argument must be of type string. Received an instance of Object
...(报错栈省略)

同时构建时还会收到字体警告:

WARN fontFamily "font1" is not a system font and has not been loaded through expo-font.

当前字体配置

代码中加载方式

使用useFonts钩子加载字体:

const [fontsLoaded] = useFonts({
    'font1': require('./assets/fonts/firstfont.otf'),
    'font2': require('./assets/fonts/secondfont.ttf'),
    ...
});

也曾尝试通过import引入字体后传入useFonts,结果一致。

app.json配置

  • android配置中包含fonts字段
  • plugins数组里配置了expo-font插件及字体列表

已尝试的排查操作

  • 修改字体文件路径
  • 调整字体声明方式(require/import)
  • 更新Expo到最新版本
  • 新建空白项目测试,问题复现

请求技术帮助定位问题根源并解决。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.25 03:36:04