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

Expo EAS本地构建报错:无法解析app.config.js中的插件模块

解决Expo EAS本地构建插件解析失败问题

问题情况

使用Expo SDK 49、expo 6.3.10、eas-cli/4.1.0(darwin-x64)、node-v19.6.1进行EAS本地构建时,app.config.js中配置的所有插件均出现解析失败问题。移除第一个插件后,下一个插件会报相同错误,说明问题不针对具体插件,而是普遍的模块解析问题。

错误日志

[READ_APP_CONFIG]
PluginError: Failed to resolve plugin for module "expo-localization" relative to "easBuild/build"
    at resolvePluginForModule (/Users/behnam/.npm/_npx/7b94c2150570f17f/node_modules/@expo/config-plugins/build/utils/plugin-resolver.js:72:11)
    at resolveConfigPluginFunctionWithInfo (/Users/behnam/.npm/_npx/7b94c2150570f17f/node_modules/@expo/config-plugins/build/utils/plugin-resolver.js:152:7)
    at resolveConfigPluginFunction (/Users/behnam/.npm/_npx/7b94c2150570f17f/node_modules/@expo/config-plugins/build/utils/plugin-resolver.js:143:7)
    at withStaticPlugin (/Users/behnam/.npm/_npx/7b94c2150570f17f/node_modules/@expo/config-plugins/build/plugins/withStaticPlugin.js:87:70)
    at /Users/behnam/.npm/_npx/7b94c2150570f17f/node_modules/@expo/config-plugins/build/plugins/withPlugins.js:30:84
    at Array.reduce (<anonymous>)
    at withPlugins (/Users/behnam/.npm/_npx/7b94c2150570f17f/node_modules/@expo/config-plugins/build/plugins/withPlugins.js:30:18)
    at withConfigPlugins (/Users/behnam/.npm/_npx/7b94c2150570f17f/node_modules/@expo/config/build/plugins/withConfigPlugins.js:36:47)
    at fillAndReturnConfig (/Users/behnam/.npm/_npx/7b94c2150570f17f/node_modules/@expo/config/build/Config.js:217:78)
    at getConfig (/Users/behnam/.npm/_npx/7b94c2150570f17f/node_modules/@expo/config/build/Config.js:268:12)

Build failed
Skipping cleanup, ./easBuild won't be removed.
Unknown error. See logs for more information.
npx exited with non-zero code: 1
    Error: build command failed.

app.config.js插件配置

plugins: [ 'expo-localization',
    [
        'expo-updates',
        {
            username: 'onrun',
        },
    ],
    [
        'expo-camera', {
            cameraPermission: 'To let you add photos to your profile or events.',
        },
    ],
    [
        'expo-build-properties',
        {
            ios: {
                flipper: true,
            },
        },
    ],
],

解决思路

  • 检查插件依赖是否安装:确保plugins数组中的所有包(如expo-localization、expo-updates等)都已通过npm install或yarn add安装到项目,EAS构建不会自动安装未声明的依赖。
  • 重置项目依赖:删除node_modules目录和package-lock.json/yarn.lock文件,重新执行依赖安装命令,避免缓存导致的依赖异常。
  • 确认构建工作目录:错误提示插件相对于easBuild/build无法解析,需确保在项目根目录执行eas build --local,避免子目录运行导致路径解析错误。
  • 切换Node.js版本:Expo SDK 49推荐使用Node.js 16.x或18.x LTS版本,当前v19.6.1可能存在兼容性问题,切换到推荐版本重试构建。
  • 校验配置文件语法:检查app.config.js的plugins数组语法,确保逗号、括号闭合,配置对象格式符合插件要求。
  • 更新CLI版本:升级eas-cli到最新稳定版(执行npm install -g eas-cli),同时更新expo-cli(执行npm install -g expo-cli),修复版本兼容bug。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.13 22:53:13