react-native: Android working fine but iOS returns an error regarding React-Codegen from project Pods

Description

iOS was working fine until this error appeared:

warning: Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyApp' from project 'MyApp')
warning: Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyApp' from project 'MyApp')

** BUILD FAILED **


The following build commands failed:
        CompileC /Users/vikrampal/Library/Developer/Xcode/DerivedData/MyApp-diuniyvicjdzntehptyxnobhkeju/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Codegen.build/Objects-normal/arm64/ShadowNodes.o /Users/vikrampal/Development/react-native/MyApp/ios/build/generated/ios/react/renderer/components/rncore/ShadowNodes.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-Codegen' from project 'Pods')
(1 failure)

Not sure why this occurred after hours of working, but I can’t seem to find a solution. I did come across this page that outlines what to do for versions for >0.69.0

https://fbflipper.com/docs/getting-started/react-native/

Version

0.70.0

Output of npx react-native info

System: OS: macOS 13.0 CPU: (10) arm64 Apple M1 Max Memory: 1.26 GB / 32.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.9.0 - /opt/homebrew/bin/node Yarn: 1.22.18 - ~/.yarn/bin/yarn npm: 8.19.1 - /opt/homebrew/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.3 - /Users/vikrampal/.rbenv/shims/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0 Android SDK: Not Found IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8815526 Xcode: 14.0/14A309 - /usr/bin/xcodebuild Languages: Java: 18.0.2 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.0 => 0.70.0 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

Running yarn ios --simulator="iPhone 14 Pro Max"

Snack, code example, screenshot, or link to a repository

Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '13.0'
install! 'cocoapods', :deterministic_uuids => false

target 'MyApp' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => true,
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => FlipperConfiguration.enabled(["Debug"], { 'Flipper' => '0.159.0' }),
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'MyAppTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (6 by maintainers)

Most upvoted comments

I figured it actually by digging through another thread, from the root of your project run the following. Cheers.

cd ios && RCT_NEW_ARCH_ENABLED=1 pod install

Edit: When you add a package to your project and need to run a pod install, use the command above so the new arch stays enabled. Otherwise, you will return to your error state until you run it again. Just a heads up.

I figured it actually by digging through another thread, from the root of your project run the following. Cheers.

cd ios && RCT_NEW_ARCH_ENABLED=1 pod install

Edit: When you add a package to your project and need to run a pod install, use the command above so the new arch stays enabled. Otherwise, you will return to your error state until you run it again. Just a heads up.

hi, i just wanted to say thank you and i wanted to give you a small donation but was unable to find a link.

After about 20 hours searching for wtf was happening with the project im trying to build for iOS, your answer was the answer i needed, i tried a 100 thousand things.

thankyou and i hope someday iOS rots in hell.

didnt work with me

Oh my god @MyPalVikram I want to wish you a happy new year coming up, thank you so much. You have saved me after 4.5 hours of debugging.

Thank you!

Was able to fix my error following the steps mentioned here: https://github.com/facebook/react-native/issues/34106#issuecomment-1179485220

Edit: found the actual fix. Apparently, the error was getting caused after an update to XCode to 14.3.0. More details can be found here: https://github.com/facebook/react-native/pull/36759. You need to update react-native to 0.70.8 to fix the issue.