react-nativeexpomonorepoeasturborepo

BUILD FAILED : 0.72.4 main.jsbundle does not exist


I am working on monorepo-turborepo with reactnative-expo app as a one of the apps in the monorepo when i try to build the react-native app I got this error (expo:49.0.7, react-native:0.72.3)

[INSTALL_PODS] [Expo] Enabling modular headers for pod SDWebImageSVGCoder
[INSTALL_PODS] Auto-generating `.xcode.env.local` with $NODE_BINARY=/Users/karam/.nvm/versions/node/v18.16.0/bin/node
[INSTALL_PODS] Auto-linking React Native modules for target `meaty`: RNGestureHandler, RNReanimated, RNSVG, RNScreens, react-native-maps, react-native-netinfo, and react-native-safe-area-context
[INSTALL_PODS] Framework build type is static library
[INSTALL_PODS] [Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
[INSTALL_PODS] [!] Invalid `Podfile` file: [codegen] Could not find react-native-codegen..
[INSTALL_PODS]  #  from /private/var/folders/mq/0tyv53vx74s515k5z6b_41xm0000gn/T/eas-build-local-nodejs/2005f8db-7b71-48b9-9854-d0e6c144fb43/build/apps/mobile/ios/Podfile:50
[INSTALL_PODS]  #  -------------------------------------------
[INSTALL_PODS]  #  
[INSTALL_PODS]  >    use_react_native!(
[INSTALL_PODS]  #      :path => config[:reactNativePath],
[INSTALL_PODS]  #  -------------------------------------------
[INSTALL_PODS] 
Error: pod install exited with non-zero code: 1
    at ChildProcess.completionListener (/Users/karam/.npm/_npx/9dcad7ace51add55/node_modules/@expo/spawn-async/build/spawnAsync.js:42:23)
    at Object.onceWrapper (node:events:628:26)
    at ChildProcess.emit (node:events:513:28)
    at maybeClose (node:internal/child_process:1091:16)
    at ChildProcess._handle.onexit (node:internal/child_process:302:5)
    ...
    at spawnAsync (/Users/karam/.npm/_npx/9dcad7ace51add55/node_modules/@expo/spawn-async/build/spawnAsync.js:7:23)
    at spawn (/Users/karam/.npm/_npx/9dcad7ace51add55/node_modules/@expo/turtle-spawn/dist/index.js:16:47)
    at installPods (/Users/karam/.npm/_npx/9dcad7ace51add55/node_modules/@expo/build-tools/dist/ios/pod.js:11:38)
    at /Users/karam/.npm/_npx/9dcad7ace51add55/node_modules/@expo/build-tools/dist/builders/ios.js:70:41
    at BuildContext.runBuildPhase (/Users/karam/.npm/_npx/9dcad7ace51add55/node_modules/@expo/build-tools/dist/context.js:101:34)
    at buildAsync (/Users/karam/.npm/_npx/9dcad7ace51add55/node_modules/@expo/build-tools/dist/builders/ios.js:69:19)
    at async runBuilderWithHooksAsync (/Users/karam/.npm/_npx/9dcad7ace51add55/node_modules/@expo/build-tools/dist/builders/common.js:12:13)
    at async Object.iosBuilder (/Users/karam/.npm/_npx/9dcad7ace51add55/node_modules/@expo/build-tools/dist/builders/ios.js:29:16)
    at async buildIosAsync (/Users/karam/.npm/_npx/9dcad7ace51add55/node_modules/eas-cli-local-build-plugin/dist/ios.js:66:12)
    at async buildAsync (/Users/karam/.npm/_npx/9dcad7ace51add55/node_modules/eas-cli-local-build-plugin/dist/build.js:54:29)

I try to update the react-native package to the latest 0.72.4 I got another error and i opened an issue in the react-native github repo https://github.com/facebook/react-native/issues/39010 all the other files in the issue details (package.json for root and app folders, metro config and babel config)

I try to run the build command locally and in expo service both same error I expect to success build my app


Solution

  • I found a the solution for this issue I am using turboRepo to manage my repo and in the mobile project I import an package from the monorepo packages

    the issue was when the cli run npm install it will not find the build version of the package, that meant I should give him something to do build for the packages after the installation is done

    I added new script to my root package.json file

    "postinstall": "dotenv -- turbo build --filter='./packages/*'",