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

by
Ali Hasan
cordova-plugins eas expo react-native

Quick Fix: Remove the local build directory specification by unsetting the EAS_LOCAL_BUILD_WORKINGDIR environment variable.

The Problem:

A developer is trying to build a React Native app using Expo’s EAS (Expo Application Services). However, the local EAS build process is failing with the error "PluginError: Failed to resolve plugin for module <module-name> relative to <build-directory>". This error occurs for various plugins included in the project’s app.config.js file, such as expo-localization, expo-updates, expo-camera, and expo-build-properties. The developer is using Expo SDK version 49, Expo CLI version 6.3.10, EAS CLI version 4.1.0, and Node.js version 19.6.1. The provided code snippet shows the plugins listed in the app.config.js file.

The Solutions:

Solution 1: Unset the `EAS_LOCAL_BUILD_WORKINGDIR` variable.

The error seems to arise due to specifying the build directory. To resolve this, you should unset the `EAS_LOCAL_BUILD_WORKINGDIR` environment variable. Here’s how you can do it:

unset EAS_LOCAL_BUILD_WORKINGDIR

After executing this command, try running the local EAS build again. It should proceed without encountering the error.

Q&A

What’s the possible cause of the error "Failed to resolve plugin for module"?

Specifying the build directory might cause the error.

How can I fix the error?

Unset the env variable EAS_LOCAL_BUILD_WORKINGDIR.

Video Explanation:

The following video, titled "How to Fix npm ERR ERESOLVE Unable to Resolve Dependency ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

Command:- npm config set legacy-peer-deps true In This Video We Will See How to Fix npm ERR ERESOLVE Unable to Resolve Dependency Tree Error ...