react-nativepluginsexpoeas

Expo EAS local build: Plugin Error: Failed to resolve plugin for module <module-name> relative to <your-build-directory>


I have a few plugins in my app.config.js file and getting the following error causing the local EAS build to fail. When I remove the first plugin, the same error occurs for the next one, so the error seems to be irrelevant to that exact plugin, but rather to any plugins. Using expo skd 49; expo version 6.3.10; eas-cli/4.1.0 darwin-x64 node-v19.6.1

Any ideas?

[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.

Plugins in 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,
                    },
                },
            ],
        ],

Solution

  • Specifying the build directory seems to be the cause of the error. When I take away the local build directory by unsetting the env variable as below, the build went okay.

    unset EAS_LOCAL_BUILD_WORKINGDIR

    Comment [July 15, 2024]: I had this issue again with expo-location on Expo SDK 51 and eas-cli/10.0.0 darwin-x64 node-v20.12.2 and this resolved it. So if you have specified the local build directory using the env variable EAS_LOCAL_BUILD_WORKINGDIR, go ahead and unset that. In this case, expo-location was not able to find the build directory as error below shows.

    PluginError: Failed to resolve plugin for module "expo-location" relative to "easDist/build"