expo / eas-cli

Fastest way to build, submit, and update iOS and Android apps
https://docs.expo.dev/eas/
MIT License
773 stars 81 forks source link

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

Closed jukkamarttinen closed 3 months ago

jukkamarttinen commented 6 months ago

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.jswas 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": {} }

szdziedzic commented 5 months ago

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?

acominotto commented 4 months ago

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 commented 4 months ago

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: https://github.com/facebook/react-native/issues/33017#issuecomment-1044059962

Looks like a remnant of macbook migration.

Thanks !

agallio commented 4 months ago

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 commented 4 months ago

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 :)

github-actions[bot] commented 3 months ago

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[bot] commented 3 months ago

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 commented 2 months ago

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 commented 2 months ago

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