EAS Build failed on monorepo unable to find ui package

Workflow: Expo prebuild
eas-cli/4.1.2 darwin-arm64 node-v18.12.1
monorepo:“turbo”: “latest”
yarnrc.yml: nmHoistingLimits: workspaces, nodeLinker: node-modules

solution that i’ve tried so far:

  • Adding and removing nmHoistingLimits: workspaces.
  • running eas build from yarn workspace klotti-app deploy:ios:dev:store
    which deploy:ios:dev:store is expo prebuild && NODE_ENV=development eas build --profile development --platform ios --auto-submit

The issue pretty much stems from eas build unable to find

 Metro encountered an error:
While trying to resolve module `@klotti/ui` from file `/Users/expo/workingdir/build/apps/klotti-app/src/app/_layout.tsx`, the package `/Users/expo/workingdir/build/packages/ui/package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`/Users/expo/workingdir/build/packages/ui/dist/index.js`. Indeed, none of these files exist:

in package.json
@klotti/ui”: “*”,


const { getDefaultConfig } = require("expo/metro-config");
const path = require("path");

// Find the project and workspace directories
const projectRoot = __dirname;
// This can be replaced with `find-yarn-workspace-root`
const workspaceRoot = path.resolve(projectRoot, "../..");

/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname, {
  // [Web-only]: Enables CSS support in Metro.
  isCSSEnabled: true,

// 1. Watch all files within the monorepo
config.watchFolders = [workspaceRoot];
// 2. Let Metro know where to resolve packages and in what order
config.resolver.nodeModulesPaths = [
  path.resolve(projectRoot, "node_modules"),
  path.resolve(workspaceRoot, "node_modules"),

config.resolver.disableHierarchicalLookup = true;

config.resolver.sourceExts.push("mjs", "cjs");

module.exports = config;

However, when i run the app, it is working perfectly fine