react-native: error: redefinition of module 'YogaKit' build Failed

Description

npx react-native run-ios

/Users/manas/Documents/projects/rn/helloapp/ios/Pods/Headers/Public/yoga/Yoga.modulemap:1:8: error: redefinition of module 'yoga'
module yoga {
       ^
/Users/manas/Documents/projects/rn/tunga/ios/Pods/Headers/Public/yoga/Yoga.modulemap:1:8: note: previously defined here
module yoga {
       ^
/Users/manas/Documents/projects/rn/helloapp/ios/Pods/Headers/Public/YogaKit/YogaKit.modulemap:1:8: error: redefinition of module 'YogaKit'
module YogaKit {
       ^
/Users/manas/Library/Developer/Xcode/DerivedData/tunga-ekvukfgeyeqjkfeirvczaszrptkv/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap:1:8: note: previously defined here
module YogaKit {
       ^
/Users/manas/Documents/projects/rn/helloapp/ios/Pods/Headers/Public/yoga/Yoga.modulemap:1:8: error: redefinition of module 'yoga'
module yoga {
       ^
/Users/manas/Documents/projects/rn/tunga/ios/Pods/Headers/Public/yoga/Yoga.modulemap:1:8: note: previously defined here
module yoga {
       ^
/Users/manas/Documents/projects/rn/helloapp/ios/Pods/Headers/Public/YogaKit/YogaKit.modulemap:1:8: error: redefinition of module 'YogaKit'
module YogaKit {
       ^
/Users/manas/Library/Developer/Xcode/DerivedData/tunga-ekvukfgeyeqjkfeirvczaszrptkv/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap:1:8: note: previously defined here
module YogaKit {
       ^
<unknown>:0: error: could not build Objective-C module 'SwiftShims'
** BUILD FAILED **


The following build commands failed:
        CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
        CompileSwift normal x86_64 /Users/manas/Documents/projects/rn/helloapp/ios/Pods/YogaKit/YogaKit/Source/YGLayoutExtensions.swift
(2 failures)

Version

0.66.4

Output of npx react-native info

System: OS: macOS 11.5.1 CPU: (4) x64 Intel® Core™ i5-7500 CPU @ 3.40GHz Memory: 176.96 MB / 24.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 16.0.0 - /usr/local/bin/node Yarn: 1.22.15 - /usr/local/bin/yarn npm: 7.10.0 - /usr/local/bin/npm Watchman: 2021.10.11.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 Android SDK: API Levels: 29, 30 Build Tools: 29.0.2, 30.0.2, 30.0.3 System Images: android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7935034 Xcode: 12.4/12D4e - /usr/bin/xcodebuild Languages: Java: 1.8.0_292 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.66.4 => 0.66.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

npx react-native run-ios

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

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (1 by maintainers)

Most upvoted comments

Simply solved by rebooting my Mac. MacBookPro M1, 2020 react-native (0.66.3) Yoga (1.14.0) YogaKit (1.18.1)

I’m having the same problem via CLI, but builds from Xcode work correctly

hiephuynhFDS I’m using such command to fix this problem: rm -rf node_modules ios/Pods && yarn && sed -i -e \"s/spec.module_name = 'yoga'/spec.module_name = 'Yoga'/g\" node_modules/react-native/ReactCommon/yoga/Yoga.podspec && npx pod-install you should do it each time when you added or removed packages in your project

Any answers to this?

@fukemy I saw this tweet https://x.com/titozzz/status/1706197950634799589?s=20, so it means RN isn’t compatible with Xcode 15 just yet if you are not on the latest version. Patches for previous versions are coming.