Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS App Store build fails with monorepo; not finding expo-router/entry.js #2280

Closed
jukkamarttinen opened this issue Mar 13, 2024 · 9 comments

Comments

@jukkamarttinen
Copy link

Build/Submit details page URL

https://expo.dev/accounts/mtv-uutiset/projects/mtvuutiset-mobile/builds/9a8c4ff3-14c7-4844-b171-b8fce7d57f2f

Summary

EAS build works for other builds / options using Monorepo, but iOS Production build fails in Run fastlane build step with the following message:
error: The resource /Users/expo/node_modules/expo-router/entry.js was not found.

Play Store build works just fine and other iOS builds as well.

Managed or bare?

Bare

Environment

expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.4
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
Yarn: 1.22.21 - ~/.nvm/versions/node/v20.11.1/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
Watchman: 2024.01.22.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.2 - /Users/jukkamarttinen/.rvm/gems/ruby-2.7.0/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
Android SDK:
API Levels: 29, 30, 33, 34
Build Tools: 29.0.2, 30.0.2, 30.0.3, 33.0.1, 33.0.2, 34.0.0, 34.0.0
System Images: android-33 | Google Play ARM 64 v8a
IDEs:
Android Studio: 2023.1 AI-231.9392.1.2311.11255304
Xcode: 15.3/15E204a - /usr/bin/xcodebuild
npmGlobalPackages:
eas-cli: 7.5.0
Expo Workflow: bare

✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for issues with metro config
✔ Check for common project setup issues
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check that packages match versions required by installed Expo SDK
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that native modules use compatible support package versions for installed Expo SDK
✔ Check native tooling versions

Error output

No response

Reproducible demo or steps to reproduce from a blank project

{
"cli": {
"version": "7.5.0",
"appVersionSource": "remote"
},
"build": {
"base": {
"node": "20.11.1",
"yarn": "1.22.21",
"ios": {
"resourceClass": "m-medium"
},
"android": {
"resourceClass": "medium"
},
"credentialsSource": "local"
},
"production": {
"extends": "base",
"distribution": "store",
"env": {
"EXPO_PUBLIC_APP_ENV": "production",
"EXPO_PUBLIC_API_URL": "api-endpoint"
},
"autoIncrement": true,
"cache": {
"disabled": true
},
"android": {
"buildType": "app-bundle"
},
"ios": {
"enterpriseProvisioning": "universal",
"buildConfiguration": "Release"
}
},
"beta": {
"extends": "base",
"distribution": "internal",
"autoIncrement": true,
"env": {
"EXPO_PUBLIC_APP_ENV": "test",
"EXPO_PUBLIC_API_URL": "api-endpoint"
},
"android": {
"buildType": "app-bundle"
},
"ios": {
"enterpriseProvisioning": "adhoc",
"buildConfiguration": "Release"
}
},
"development": {
"extends": "base",
"developmentClient": true,
"distribution": "internal",
"ios": {
"simulator": true
}
},
"preview": {
"extends": "base",
"config": "test.yml",
"distribution": "internal",
"env": {
"EXPO_PUBLIC_APP_ENV": "development",
"EXPO_PUBLIC_API_URL": "api-endpoint"
}
},
"local": {
"extends": "base",
"distribution": "internal",
"android": {
"buildType": "apk"
},
"ios": {
"simulator": true
},
"developmentClient": true,
"env": {
"EXPO_PUBLIC_APP_ENV": "development",
"EXPO_PUBLIC_API_URL": "api-endpoint"
}
}
},
"submit": {}
}

@jukkamarttinen jukkamarttinen added the needs review Issue is ready to be reviewed by a maintainer label Mar 13, 2024
@jukkamarttinen jukkamarttinen changed the title iOS App Store build fails with monorepo is not finding expo-router/entry.js iOS App Store build fails with monorepo; not finding expo-router/entry.js Mar 13, 2024
@szdziedzic
Copy link
Member

Hi, I see this log in your Prebuild phase for the failed build

The ios project is malformed, project files will be cleared and reinitialized.

and I don't see it for a successful sim build.

Did something change in your project between making a sim build and prod one?

@szdziedzic szdziedzic added needs more info and removed needs review Issue is ready to be reviewed by a maintainer labels Apr 16, 2024
@acominotto
Copy link

I have the same issue locally, with command eas build -p ios --profile preview --local

❌ error: The resource /private/var/folders/g5/vynwwv4j6676sr9ysysfqz440000gn/T/eas-build-local-nodejs/node_modules/expo-router/entry.js was not found.

I am using turborepo. The file is indeed not present as /private/var/folders/g5/vynwwv4j6676sr9ysysfqz440000gn/T/eas-build-local-nodejs/ is an empty folder
here is my eas.json

  "build": {
    "production": {
      "env": {
        "APP_ENV": "production",
        "NODE_ENV": "production"
      }
    },
    "development": {
      "env": {
        "APP_ENV": "dev",
        "NODE_ENV": "development"
      },
      "distribution": "internal",
      "developmentClient": true
    },
    "preview": {
      "env": {
        "APP_ENV": "dev",
        "NODE_ENV": "production"
      },
      "distribution": "internal"
    }
  }
}

@acominotto
Copy link

I have the same issue locally, with command eas build -p ios --profile preview --local

❌ error: The resource /private/var/folders/g5/vynwwv4j6676sr9ysysfqz440000gn/T/eas-build-local-nodejs/node_modules/expo-router/entry.js was not found.

I am using turborepo. The file is indeed not present as /private/var/folders/g5/vynwwv4j6676sr9ysysfqz440000gn/T/eas-build-local-nodejs/ is an empty folder here is my eas.json

  "build": {
    "production": {
      "env": {
        "APP_ENV": "production",
        "NODE_ENV": "production"
      }
    },
    "development": {
      "env": {
        "APP_ENV": "dev",
        "NODE_ENV": "development"
      },
      "distribution": "internal",
      "developmentClient": true
    },
    "preview": {
      "env": {
        "APP_ENV": "dev",
        "NODE_ENV": "production"
      },
      "distribution": "internal"
    }
  }
}

Looks like I finally managed to build, I am not sure what exactly did it, but I changed the arch of cocoapods from x86 to arm according to this comment: facebook/react-native#33017 (comment)

Looks like a remnant of macbook migration.

Thanks !

@agallio
Copy link

agallio commented Apr 27, 2024

Hi, I encounter the same issue. When running it locally using npx expo run:ios the app can be built properly. But when I tried using npx expo run:ios --configuration Release it returned the same error as reported:

error: The resource /Users/expo/node_modules/expo-router/entry.js was not found.

Can anyone help?

@acominotto
Copy link

Turns out I still had the issue afterwards. I seem to have fixed it however.

I checked using xcode what could be happening and it seems having

EXPO_USE_METRO_WORKSPACE_ROOT=1

in the .env was the issue. It made metro look for the the expo-router/entry two parents folders above its real location.

I finally succeeded in building the .ipa once I got rid of the variable in my .env.

Please tell me if you were in the same case as me :)

Copy link

github-actions bot commented Jun 7, 2024

This issue is stale because it has been open for 30 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

@github-actions github-actions bot added the stale label Jun 7, 2024
Copy link

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.

@hlspablo
Copy link

Hi, I encounter the same issue. When running it locally using npx expo run:ios the app can be built properly. But when I tried using npx expo run:ios --configuration Release it returned the same error as reported:

error: The resource /Users/expo/node_modules/expo-router/entry.js was not found.

Can anyone help?

You solved the problem, and how?

@Monte9
Copy link

Monte9 commented Jun 21, 2024

I checked using xcode what could be happening and it seems having
EXPO_USE_METRO_WORKSPACE_ROOT=1

@acominotto your solution was clutch! 💯 We have a monorepo setup (using Vercel turborepo) and this was the solution that worked for us.

We set EXPO_USE_METRO_WORKSPACE_ROOT to 1 for our dev environment that runs locally and we set it to 0 in eas.json to build for preview & production

duongdev pushed a commit to get6pm/6pm that referenced this issue Aug 7, 2024
Note:
Set `EXPO_USE_METRO_WORKSPACE_ROOT=0` on EAS for production build, this variable is only necessary on development.

expo/eas-cli#2280 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants