1

Trying to start react native project on iOS simulator whit MacBook Air M1 failed with this error

:0: error: module map file '/Users/userName/Library/Developer/Xcode/DerivedData/projectName-czhmfookabhyqzdsutttonzlxnsi/Build/Products/Debug-iphonesimulator/FBSDKCoreKit/FBSDKCoreKit.modulemap'not found
:0: error: module map file '/Users/erName/Library/Developer/Xcode/DerivedData/projectName-czhmfookabhyqzdsutttonzlxnsi/Build/Products/Debug-iphonesimulator/FBSDKCoreKit/FBSDKCoreKit.modulemap'not found
:0: error: missing required module 'SwiftShims'

** BUILD FAILED **

The following build commands failed:

CompileSwift normal x86_64 [path-to-project-folder]/ios/File.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler

I've already tried to

  • open .xcworkspace with Xcode
  • delete node_modules, package-lock.json, and podfile.lock;
  • npm install;
  • pod install inside iOS folder
  • clean DerivedData folder
  • rebuild project

INFO #

System:
    OS: macOS 11.3 
    CPU: (8) arm64 Apple M1 
    Memory: 177.69 MB / 8.00 GB 
    Shell: 5.8 - /bin/zsh 
  Binaries: 
    Node: 15.14.0 - /opt/homebrew/bin/node 
    npm: 7.7.6 - /opt/homebrew/bin/npm 
    Watchman: 4.9.0 - /opt/homebrew/bin/watchman 
  SDKs: 
    iOS SDK: 
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4 
    Android SDK: 
      API Levels: 27, 28, 29, 30
      Build Tools: 28.0.3, 29.0.2, 30.0.3 
      System Images: android-29 | Automotive with Play Store Intel x86 Atom, android-29 | Android TV Intel x86 Atom, android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom 
  IDEs: 
    Android Studio: 4.1 AI-201.8743.12.41.7199119 
    Xcode: 12.5/12E262 - /usr/bin/xcodebuild 
  npmPackages: 
    react: 16.9.0 => 16.9.0  
    react-native: ^0.61.5 => 0.61.5  
  npmGlobalPackages: 
    react-native-cli: 2.0.1 

Pod file

platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target '[tName]' do

  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera"
  pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/'
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
  pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  
  pod 'GoogleSignIn', '~> 5.0.2'
  
  # react-native-geolocation-service
  pod 'react-native-geolocation', path: '../node_modules/@react-native-community/geolocation'

  # use_frameworks!
  pod 'TwitterKit5'

#  google idfa support
  pod 'GoogleIDFASupport', '~> 3.14'

  target '[tNameTests]' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
  
#  GOOGLE MAPS REQUIRE
  rn_maps_path = '../node_modules/react-native-maps'
   pod 'react-native-google-maps', :path => rn_maps_path
   pod 'GoogleMaps'
   pod 'Google-Maps-iOS-Utils'
   
end

  target '[tName]-tvOS' do
   # Pods for [tName]-tvOS

   target '[tName]-tvOSTests' do
     inherit! :search_paths
     # Pods for testing
   end

end
    
 post_install do |installer|
     ## Fix for XCode 12.5 beta
     find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm", "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
     find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
         "RCTBridgeModuleNameForClass(module))", "RCTBridgeModuleNameForClass(Class(module)))")
 end

 def find_and_replace(dir, findstr, replacestr)
   Dir[dir].each do |name|
      text = File.read(name)
      replace = text.gsub(findstr,replacestr)
       if text != replace
           puts "Fix: " + name
           File.open(name, "w") { |file| file.puts replace }
           STDOUT.flush
       end
   end
   Dir[dir + '*/'].each(&method(:find_and_replace))
 end
1
  • Happening to me on Intel Mac as well Commented Aug 18, 2021 at 15:51

1 Answer 1

3

It's not just you, this is an open issue. Below are links to the issue thread and a troubleshooting guide:

Sign up to request clarification or add additional context in comments.

3 Comments

Any update on this one? Tried all the approaches. Seems like upgrade is the only way out
@Amit - I ended up reverting to an older version of XCode (12.4) as this was in relation to a production application thus didn't have the luxury of time.
Same here. I am using the 12.4 only. But wanted to upgrade to the latest to use the latest simulators.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.