expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.

Home Page:https://docs.expo.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

expo run:ios build fails(fresh project)

rdinizz opened this issue · comments

Summary

I just created a new expo project using npx create-expo-app using typescript/react navigation template and i also added @expo/webpack-config@^0.17.2 for web support, nothing else. No custom code added, just the scaffold that expo generates. When i try to run npx expo run:ios i get the following errors:

$ expo run:ios
› Planning build
› Compiling react-native Pods/React-RCTBlob » RCTFileReaderModule.mm
› Compiling react-native Pods/React-RCTImage » RCTImageStoreManager.mm
› Compiling react-native Pods/React-RCTImage » RCTImageLoader.mm
› Compiling react-native Pods/React-RCTImage » RCTImageEditingManager.mm
› Compiling react-native Pods/React-RCTImage » RCTGIFImageDecoder.mm
› Compiling react-native Pods/React-RCTBlob » RCTBlobPlugins.mm
› Compiling react-native Pods/React-RCTBlob » RCTBlobManager.mm
› Compiling react-native Pods/React-RCTBlob » RCTBlobCollector.mm
› Compiling base-app-mobile-web Pods/React-Codegen » FBReactNativeSpec-generated.mm

❌  (node_modules/expo-modules-core/ios/Swift/DynamicTypes/DynamicEnumType.swift:7:22)

   5 |  */
   6 | internal struct DynamicEnumType: AnyDynamicType {
>  7 |   let innerType: any Enumerable.Type
     |                      ^ protocol 'Enumerable' can only be used as a generic constraint because it has Self or associated type requirements
   8 | 
   9 |   func wraps<InnerType>(_ type: InnerType.Type) -> Bool {
  10 |     return innerType == InnerType.self


❌  (node_modules/expo-modules-core/ios/Swift/DynamicTypes/DynamicType.swift:21:36)

  19 |     return DynamicConvertibleType(innerType: ConvertibleType)
  20 |   }
> 21 |   if let EnumType = T.self as? any Enumerable.Type {
     |                                    ^ protocol 'Enumerable' can only be used as a generic constraint because it has Self or associated type requirements
  22 |     return DynamicEnumType(innerType: EnumType)
  23 |   }
  24 |   if let SharedObjectType = T.self as? SharedObject.Type {


❌  (node_modules/expo-modules-core/ios/Swift/Objects/PropertyComponent.swift:142:9)

  140 |       }
  141 |       guard let getter = self.getter else {
> 142 |         return
      |         ^ non-void function should return a value
  143 |       }
  144 |       return try getter.call(by: this, withArguments: args)
  145 |     }


❌  (node_modules/expo-modules-core/ios/Swift/Objects/PropertyComponent.swift:157:9)

  155 |       }
  156 |       guard let setter = self.setter else {
> 157 |         return
      |         ^ non-void function should return a value
  158 |       }
  159 |       return try setter.call(by: this, withArguments: args)
  160 |     }

› Compiling react-native Pods/React-CoreModules » React-CoreModules-dummy.m
› Compiling react-native Pods/React-CoreModules » RCTWebSocketModule.mm
› Compiling react-native Pods/React-CoreModules » RCTWebSocketExecutor.mm
› Compiling react-native Pods/React-CoreModules » RCTTiming.mm
› Compiling react-native Pods/React-CoreModules » RCTStatusBarManager.mm
› Compiling react-native Pods/React-CoreModules » RCTSourceCode.mm
› Compiling react-native Pods/React-CoreModules » RCTRedBox.mm
› Compiling react-native Pods/React-CoreModules » RCTPlatform.mm
› Compiling react-native Pods/React-CoreModules » RCTPerfMonitor.mm
› Compiling react-native Pods/React-CoreModules » RCTLogBoxView.mm
› Compiling react-native Pods/React-CoreModules » RCTLogBox.mm
› Compiling react-native Pods/React-CoreModules » RCTKeyboardObserver.mm
› Compiling react-native Pods/React-CoreModules » RCTI18nManager.mm

› 4 error(s), and 0 warning(s)```

### What platform(s) does this occur on?

iOS

### SDK Version

_No response_

### Environment

expo-env-info 1.0.5 environment info:
    System:
      OS: macOS 12.4
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 14.19.2 - ~/.nvm/versions/node/v14.19.2/bin/node
      Yarn: 1.22.10 - /usr/local/bin/yarn
      npm: 6.14.17 - ~/.nvm/versions/node/v14.19.2/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    Managers:
      CocoaPods: 1.11.3 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5
      Android SDK:
        API Levels: 29, 30
        Build Tools: 28.0.3, 29.0.2, 30.0.2
        System Images: android-30 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 4.1 AI-201.8743.12.41.6858069
      Xcode: 13.3.1/13E500a - /usr/bin/xcodebuild
    npmPackages:
      @expo/webpack-config: ^0.17.2 => 0.17.4 
      expo: ~47.0.12 => 47.0.12 
      react: 18.1.0 => 18.1.0 
      react-dom: 18.1.0 => 18.1.0 
      react-native: 0.70.5 => 0.70.5 
      react-native-web: ~0.18.9 => 0.18.10 
    Expo Workflow: managed

### Minimal reproducible example

npx create-expo-app, select navigation/typescript template, add @expo/webpack-config and try to build for ios.

I had a similar problem:

.....

  (node_modules/expo-modules-core/ios/Swift/DynamicTypes/DynamicEnumType.swift:7:22)

   5 |  */
   6 | internal struct DynamicEnumType: AnyDynamicType {
>  7 |   let innerType: any Enumerable.Type
     |                      ^ protocol 'Enumerable' can only be used as a generic constraint because it has Self or associated type requirements
   8 | 
   9 |   func wraps<InnerType>(_ type: InnerType.Type) -> Bool {
  10 |     return innerType == InnerType.self


  (node_modules/expo-modules-core/ios/Swift/DynamicTypes/DynamicType.swift:21:36)

  19 |     return DynamicConvertibleType(innerType: ConvertibleType)
  20 |   }
> 21 |   if let EnumType = T.self as? any Enumerable.Type {
     |                                    ^ protocol 'Enumerable' can only be used as a generic constraint because it has Self or associated type requirements
  22 |     return DynamicEnumType(innerType: EnumType)
  23 |   }
  24 |   if let SharedObjectType = T.self as? SharedObject.Type {


  (node_modules/expo-modules-core/ios/Swift/Objects/PropertyComponent.swift:142:9)

  140 |       }
  141 |       guard let getter = self.getter else {
> 142 |         return
      |         ^ non-void function should return a value
  143 |       }
  144 |       return try getter.call(by: this, withArguments: args)
  145 |     }


  (node_modules/expo-modules-core/ios/Swift/Objects/PropertyComponent.swift:157:9)

  155 |       }
  156 |       guard let setter = self.setter else {
> 157 |         return
      |         ^ non-void function should return a value
  158 |       }
  159 |       return try setter.call(by: this, withArguments: args)
  160 |     }

....


 4 error(s), and 27 warning(s)

CommandError: Failed to build iOS project. "xcodebuild" exited with error code 65.
   expo-env-info 1.0.5 environment info:
      System:
        OS: macOS 12.5
        Shell: 3.2.57 - /bin/bash
      Binaries:
        Node: 18.7.0 - /usr/local/bin/node
        Yarn: 1.22.19 - /usr/local/bin/yarn
        npm: 8.15.0 - /usr/local/bin/npm
        Watchman: 2022.07.04.00 - /usr/local/bin/watchman
      Managers:
        CocoaPods: 1.11.3 - /usr/local/bin/pod
      SDKs:
        iOS SDK:
          Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
      IDEs:
        Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
      npmPackages:
        expo: ~47.0.12 => 47.0.13 
        react: 18.1.0 => 18.1.0 
        react-dom: 18.1.0 => 18.1.0 
        react-native: 0.70.5 => 0.70.5 
        react-native-web: ~0.18.7 => 0.18.10 
      npmGlobalPackages:
        expo-cli: 6.1.0
      Expo Workflow: bare

Having the exact same probem here: #20764

Same issue

same here

same error here

Looks like you have a pretty old version of Xcode. Could you try again after upgrading to the latest (14.2)?

I'm on xcode 14.2 and having the same issue @tsapeta

/Users/.../Desktop/EventApp/event-app/event-app/node_modules/expo-modules-core/ios/Swift/Arguments/Convertible.swift:18:18: error: invalid redeclaration of 'ConvertibleArgument'
public typealias ConvertibleArgument = Convertible
                 ^
/Users/.../Desktop/EventApp/event-app/event-app/node_modules/expo-modules-core/ios/Swift/Arguments/ConvertibleArgument.swift:9:17: note: 'ConvertibleArgument' previously declared here
public protocol ConvertibleArgument: AnyArgument {
                ^
/Users/.../Desktop/EventApp/event-app/event-app/node_modules/expo-modules-core/ios/Swift/Arguments/EnumArgument.swift:28:18: error: 'EnumArgument' is ambiguous for type lookup in this context
public extension EnumArgument where Self: RawRepresentable, Self: Hashable {
                 ^~~~~~~~~~~~
/Users/.../Desktop/EventApp/event-app/event-app/node_modules/expo-modules-core/ios/Swift/Arguments/EnumArgument.swift:6:17: note: found this candidate
public protocol EnumArgument: AnyArgument {
                ^
/Users/.../Desktop/EventApp/event-app/event-app/node_modules/expo-modules-core/ios/Swift/Arguments/Enumerable.swift:25:18: note: found this candidate
public typealias EnumArgument = Enumerable
                 ^
/Users/.../Desktop/EventApp/event-app/event-app/node_modules/expo-modules-core/ios/Swift/Arguments/EnumArgument.swift:6:17: error: invalid redeclaration of 'EnumArgument'
public protocol EnumArgument: AnyArgument {
                ^
/Users/.../Desktop/EventApp/event-app/event-app/node_modules/expo-modules-core/ios/Swift/Arguments/Enumerable.swift:25:18: note: 'EnumArgument' previously declared here
public typealias EnumArgument = Enumerable
                 ^
/Users/.../Desktop/EventApp/event-app/event-app/node_modules/expo-modules-core/ios/Swift/Arguments/EnumArgument.swift:65:16: error: invalid redeclaration of 'EnumCastingException'
internal class EnumCastingException: GenericException<(type: Any.Type, value: Any)> {
               ^
/Users/.../Desktop/EventApp/event-app/event-app/node_modules/expo-modules-core/ios/Swift/Arguments/Enumerable.swift:54:16: note: 'EnumCastingException' previously declared here
internal class EnumCastingException: GenericException<(type: Any.Type, value: Any)> {
               ^
/Users/.../Desktop/EventApp/event-app/event-app/node_modules/expo-modules-core/ios/Swift/Arguments/EnumArgument.swift:74:66: error: 'EnumArgument' is ambiguous for type lookup in this context
internal class EnumNoSuchValueException: GenericException<(type: EnumArgument.Type, value: Any)> {
                                                                 ^~~~~~~~~~~~
/Users/.../Desktop/EventApp/event-app/event-app/node_modules/expo-modules-core/ios/Swift/Arguments/EnumArgument.swift:6:17: note: found this candidate
public protocol EnumArgument: AnyArgument {
                ^
/Users/.../Desktop/EventApp/event-app/event-app/node_modules/expo-modules-core/ios/Swift/Arguments/Enumerable.swift:25:18: note: found this candidate
public typealias EnumArgument = Enumerable
                 ^
/Users/.../Desktop/EventApp/event-app/event-app/node_modules/expo-modules-core/ios/Swift/Arguments/EnumArgument.swift:74:16: error: invalid redeclaration of 'EnumNoSuchValueException'
internal class EnumNoSuchValueException: GenericException<(type: EnumArgument.Type, value: Any)> {
               ^

Different errors, but all still to do with expo-modules-core

commented

Same

Try to upgrade expo on the app store.

commented

@ithunter101 I don't use expo from the app store. I am using bare workflow...

@0x-s13i your issue is completely different than this, so please don't spam here and just wait until I get to the issue you reported.

Apologies @tsapeta. Seems to be problems with the Expo Modules Core repo so I assumed it was linked in some way. I seem to have fixed some issues by manually copying the main folder on GitHub, and then came across different issues now with the AppDelegates folder. My thinking was that they would all be linked, but I hear you, and will wait until you can get around to it 👍

I'm experiencing build failures with the same error after upgrading an existing expo bare project from 46 to 47.

@TomasMorton have you tried to upgrade Xcode? See my comment here #20777 (comment)

@TomasMorton have you tried to upgrade Xcode? See my comment here #20777 (comment)

@tsapeta thanks for the quick reply. Definitely my mistake, I didn't realise our build agent was configured for Xcode 13.4.1. Working great now 😊

Looks like you have a pretty old version of Xcode. Could you try again after upgrading to the latest (14.2)?

Works with Xcode 14.2. Thank you.

Same

node -v
v16.19.0

npm -v
9.3.0

nvm -v
0.39.3

yarn -v
1.22.17

expo --version
6.1.0

xcode
13.4.1


❌  (/Users/inacio/Documents/Bitbucket/employees-app/node_modules/expo-modules-core/ios/Swift/DynamicTypes/DynamicEnumType.swift:7:22)

   5 |  */
   6 | internal struct DynamicEnumType: AnyDynamicType {
>  7 |   let innerType: any Enumerable.Type
     |                      ^ protocol 'Enumerable' can only be used as a generic constraint because it has Self or associated type requirements
   8 | 
   9 |   func wraps<InnerType>(_ type: InnerType.Type) -> Bool {
  10 |     return innerType == InnerType.self


❌  (/Users/inacio/Documents/Bitbucket/employees-app/node_modules/expo-modules-core/ios/Swift/DynamicTypes/DynamicType.swift:21:36)

  19 |     return DynamicConvertibleType(innerType: ConvertibleType)
  20 |   }
> 21 |   if let EnumType = T.self as? any Enumerable.Type {
     |                                    ^ protocol 'Enumerable' can only be used as a generic constraint because it has Self or associated type requirements
  22 |     return DynamicEnumType(innerType: EnumType)
  23 |   }
  24 |   if let SharedObjectType = T.self as? SharedObject.Type {


❌  (/Users/inacio/Documents/Bitbucket/employees-app/node_modules/expo-modules-core/ios/Swift/Objects/PropertyComponent.swift:142:9)

  140 |       }
  141 |       guard let getter = self.getter else {
> 142 |         return
      |         ^ non-void function should return a value
  143 |       }
  144 |       return try getter.call(by: this, withArguments: args)
  145 |     }


❌  (/Users/inacio/Documents/Bitbucket/employees-app/node_modules/expo-modules-core/ios/Swift/Objects/PropertyComponent.swift:157:9)

  155 |       }
  156 |       guard let setter = self.setter else {
> 157 |         return
      |         ^ non-void function should return a value
  158 |       }
  159 |       return try setter.call(by: this, withArguments: args)
  160 |     }

› Compiling react-native Pods/React-RCTVibration » RCTVibration.mm
› Compiling react-native Pods/React-RCTSettings » RCTSettingsManager.mm
› Compiling react-native Pods/React-RCTNetwork » RCTNetworking.mm
› Compiling react-native Pods/React-RCTNetwork » RCTNetworkPlugins.mm
› Compiling react-native Pods/React-RCTNetwork » RCTFileRequestHandler.mm
› Compiling react-native Pods/React-RCTNetwork » RCTHTTPRequestHandler.mm
› Compiling react-native Pods/React-RCTNetwork » RCTDataRequestHandler.mm

› 4 error(s), and 0 warning(s)

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

@vinaciotm The solution has already been posted here several times. Just upgrade Xcode to the latest (14.2) and these errors should go away.