skip to Main Content

I’m having issues building an ios app with expo & react native. After running the command npx expo run:ios, the error I get, which I believe is fairly generic, is:

CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.

The last message in the terminal before it threw an error is:
Compiling react-native Pods/FlipperKit » FLEXNetworkTransaction.m

Things I’ve tried so far include:

  • Deleting Xcode caches.
  • Deleting Derived data using the command rm -rf ~/Library/Developer/Xcode/DerivedData
  • Followed the instructions for the top answer on a similar stackoverflow question here

My setup:

  • Chip: Apple M1 Pro Chip.
  • macOS: Sonoma 14.3.1
  • node version: 14.19.2
  • react-native version: 0.70.8
  • Xcode version: 15.3
  • Cocoapods version: 1.12.1

Not sure if it’s needed but the flipper versions I have are:

  • react-native-flipper: 0.177.0
  • expo-community-flipper: 47.0.2

Any help would be appreciated, thanks

Edit: Below is the error logs I’m getting in the terminal

 Compiling react-native Pods/FlipperKit » FlipperPlatformWebSocket.mm

❌(/Users/....filePathHere.../ios/Pods/FlipperKit/ios/Pods/Headers/Private/Flipper/FlipperTransportTypes.h:24:14)

  22 |  Possible events are but not limited to: open, close, error.
  23 |  */
> 24 | typedef std::function<void(SocketEvent)> SocketEventHandler;
     |              ^ no template named 'function' in namespace 'std'
  25 | 
  26 | /**
  27 |  Defines a socket message received handler.


❌(/Users/....filePathHere.../ios/Pods/FlipperKit/ios/Pods/Headers/Private/Flipper/FlipperTransportTypes.h:29:14)

  27 |  Defines a socket message received handler.
  28 |  */
> 29 | typedef std::function<void(const std::string& message)> SocketMessageHandler;
     |              ^ no template named 'function' in namespace 'std'
  30 | 
  31 | /**
  32 |  Defines a socket certificate provider. The provider is responsible of returning


❌(/Users/....filePathHere.../ios/Pods/FlipperKit/ios/Pods/Headers/Private/Flipper/FlipperTransportTypes.h:38:14)

  36 |  @param length Length of the password buffer.
  37 |  */
> 38 | typedef std::function<std::string(char* password, size_t length)>
     |              ^ no template named 'function' in namespace 'std'
  39 |     SocketCertificateProvider;
  40 | 
  41 | /**


❌(/Users/....filePathHere.../ios/Pods/FlipperKit/ios/Pods/Headers/Private/Flipper/FlipperTransportTypes.h:45:14)

  43 |  that data has been sent to the receiving end.
  44 |  */
> 45 | typedef std::function<void()> SocketSendHandler;
     |              ^ no template named 'function' in namespace 'std'
  46 | 
  47 | /**
  48 |  Defines a socket send completion handler for the cases where a response is


❌(/Users/....filePathHere.../ios/Pods/FlipperKit/ios/Pods/Headers/Private/Flipper/FlipperTransportTypes.h:54:14)

  52 |  response will contain text describing the error.
  53 |  */
> 54 | typedef std::function<void(std::string response, bool isError)>
     |              ^ no template named 'function' in namespace 'std'
  55 |     SocketSendExpectResponseHandler;
  56 | 
  57 | /**


❌(/Users/....filePathHere.../ios/Pods/FlipperKit/ios/Pods/FlipperKit/iOS/FlipperKit/FlipperPlatformWebSocket.mm:57:46)

  55 | 
  56 |   char PASSWORD[512] = {};
> 57 |   auto certificatePath = _certificateProvider(&PASSWORD[0], 512);
     |                                              ^ called object type 'facebook::flipper::SocketCertificateProvider' is not a function or function pointer
  58 | 
  59 |   NSString* certificatePathObjC =
  60 |       [NSString stringWithUTF8String:certificatePath.c_str()];


❌(/Users/....filePathHere.../ios/Pods/FlipperKit/ios/Pods/FlipperKit/iOS/FlipperKit/FlipperPlatformWebSocket.mm:158:18)

  156 |     // not notify the delegate. SocketRocket only triggers the close event
  157 |     // when the connection is closed from the server.
> 158 |     _eventHandler(facebook::flipper::SocketEvent::CLOSE);
      |                  ^ called object type 'facebook::flipper::SocketEventHandler' is not a function or function pointer
  159 |     // Clear the socket delegate before close. Ensures that we won't get
  160 |     // any messages after the disconnect takes place.
  161 |     _socket.delegate = nil;


❌(/Users/....filePathHere.../ios/Pods/FlipperKit/ios/Pods/FlipperKit/iOS/FlipperKit/FlipperPlatformWebSocket.mm:185:16)

  183 | 
  184 | - (void)webSocketDidOpen:(SRWebSocket*)webSocket {
> 185 |   _eventHandler(facebook::flipper::SocketEvent::OPEN);
      |                ^ called object type 'facebook::flipper::SocketEventHandler' is not a function or function pointer
  186 | 
  187 |   if (!_keepAlive) {
  188 |     __weak auto weakSocket = _socket;


❌(/Users/....filePathHere.../ios/Pods/FlipperKit/ios/Pods/FlipperKit/iOS/FlipperKit/FlipperPlatformWebSocket.mm:206:18)

  204 |    */
  205 |   if ([[error domain] isEqual:NSOSStatusErrorDomain] && [error code] == -9806) {
> 206 |     _eventHandler(facebook::flipper::SocketEvent::SSL_ERROR);
      |                  ^ called object type 'facebook::flipper::SocketEventHandler' is not a function or function pointer
  207 |   } else {
  208 |     _eventHandler(facebook::flipper::SocketEvent::ERROR);
  209 |   }


❌(//Users/....filePathHere.../ios/Pods/FlipperKit/ios/Pods/FlipperKit/iOS/FlipperKit/FlipperPlatformWebSocket.mm:208:18)

  206 |     _eventHandler(facebook::flipper::SocketEvent::SSL_ERROR);
  207 |   } else {
> 208 |     _eventHandler(facebook::flipper::SocketEvent::ERROR);
      |                  ^ called object type 'facebook::flipper::SocketEventHandler' is not a function or function pointer
  209 |   }
  210 |   _socket = nil;
  211 | }


❌(/Users/....filePathHere.../ios/Pods/FlipperKit/iOS/FlipperKit/FlipperPlatformWebSocket.mm:217:16)

  215 |               reason:(NSString*)reason
  216 |             wasClean:(BOOL)wasClean {
> 217 |   _eventHandler(facebook::flipper::SocketEvent::CLOSE);
      |                ^ called object type 'facebook::flipper::SocketEventHandler' is not a function or function pointer
  218 |   _socket = nil;
  219 | }
  220 | 


❌(/Users/....filePathHere.../ios/Pods/FlipperKit/iOS/FlipperKit/FlipperPlatformWebSocket.mm:224:20)

  222 |   if (message && _messageHandler) {
  223 |     NSString* response = message;
> 224 |     _messageHandler([response UTF8String]);
      |                    ^ called object type 'facebook::flipper::SocketMessageHandler' is not a function or function pointer
  225 |   }
  226 | }
  227 | 

› Compiling react-native Pods/FlipperKit » FlipperKitNetworkPlugin.mm
› Compiling react-native Pods/FlipperKit » FlipperKitLayoutPlugin.mm
› Compiling react-native Pods/FlipperKit » FlipperKit-dummy.m
› Compiling react-native Pods/FlipperKit » FlipperCppBridgingResponder.mm
› Compiling react-native Pods/FlipperKit » FlipperCppBridgingConnection.mm
› Compiling react-native Pods/FlipperKit » FlipperClient.mm
› Compiling react-native Pods/FlipperKit » FLEXNetworkTransaction.m
› Compiling react-native Pods/FlipperKit » FLEXNetworkRecorder.mm
› Compiling react-native Pods/FlipperKit » FLEXNetworkObserver.mm
    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 'ViewTrail' from project 'ViewTrail')
    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 'ViewTrail' from project 'ViewTrail')
    Run script build phase '[CP-User] Generate app.config for prebuilt Constants.manifest' 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 'EXConstants' from project 'Pods')

› 12 error(s), and 3 warning(s)

CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.

2

Answers


  1. We had similar issue when updating xCode to 15.3 version. The issue was associated with Flipper as well.

    The issue was with FlipperTransportTypes.h file. the issue throws No template named 'function' in namespace 'std'

    The Fix was adding #include <functional> after #include <string> statement.

    If you still have issues after that than you might need to add it to some other files.

    This will solve your problem.

    Login or Signup to reply.
  2. With the accepted solutions provided by Sally is not ideal as you have to do that manually every time. Here is the alternative..

    Solution 1:

    Open Podfile in iOS Folder, comment the line:
    :flipper_configuration => flipper_config,

    run pod install

    This removes Flipper:

    Removing CocoaAsyncSocket
    Removing Flipper
    Removing Flipper-Boost-iOSX
    Removing Flipper-DoubleConversion
    Removing Flipper-Fmt
    Removing Flipper-Folly
    Removing Flipper-Glog
    Removing Flipper-PeerTalk
    Removing FlipperKit
    Removing OpenSSL-Universal
    

    Then run npm run ios

    Solution 2:

    If you still want to use flipper you can add this to your post_install

    post_install do |installer|
        installer.pods_project.targets.each do |target|
          if target.name == 'Flipper'
            file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
            contents = File.read(file_path)
            unless contents.include?('#include <functional>')
              File.open(file_path, 'w') do |file|
                file.puts('#include <functional>')
                file.puts(contents)
              end
            end
          end
        end
      end
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search