Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IOS][expo-modules-core] error: exception specification of overriding function is more lax than base version #28633

Closed
marelix2 opened this issue May 6, 2024 · 14 comments
Labels
Expo Modules Core iOS needs review Issue is ready to be reviewed by a maintainer

Comments

@marelix2
Copy link

marelix2 commented May 6, 2024

Summary

after updating react-native from 0.73.6 to 0.74.1 version im getting errors

/Users/mr/repos/xx/xx-mobile-app/node_modules/expo-modules-core/ios/JSI/EXJavaScriptRuntime.mm:31:8: error: exception specification of overriding function is more lax than base version
  void invokeAsync(std::function<void()> &&func) override {
       ^
In file included from /Users/mr/repos/xx/xx-mobile-app/node_modules/expo-modules-core/ios/JSI/EXJavaScriptRuntime.mm:17:
In file included from /Users/mr/repos/xx/xx-mobile-app/node_modules/expo-modules-core/ios/JSI/EXJavaScriptRuntime.h:9:
/Users/mr/repos/xx/xx-mobile-app/ios/Pods/Headers/Public/React-callinvoker/ReactCommon/CallInvoker.h:25:16: note: overridden virtual function is here
  virtual void invokeAsync(CallFunc&& func) noexcept = 0;
               ^
13 warnings and 1 error generated.

/Users/mr/repos/xx/xx-mobile-app/node_modules/expo-modules-core/ios/JSI/EXJavaScriptRuntime.mm:31:8: Exception specification of overriding function is more lax than base version

Screenshot 2024-05-06 at 12 54 16

my package.json

{
  "name": "xx",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
  },
  "dependencies": {
    "@bam.tech/react-native-image-resizer": "^3.0.7",
    "@logrocket/react-native": "^1.33.1",
    "@react-native-async-storage/async-storage": "^1.23.1",
    "@react-native-camera-roll/camera-roll": "^7.6.0",
    "@react-native-clipboard/clipboard": "^1.14.0",
    "@react-native-community/datetimepicker": "^7.6.3",
    "@react-native-community/netinfo": "^11.3.1",
    "@react-native/metro-config": "^0.73.5",
    "@react-navigation/bottom-tabs": "^6.5.12",
    "@react-navigation/native": "^6.1.10",
    "@react-navigation/native-stack": "^6.9.18",
    "@sendbird/chat": "^4.12.1",
    "@sendbird/uikit-react-native": "^3.5.2",
    "@sendbird/uikit-react-native-foundation": "^3.5.2",
    "@sentry/react-native": "^5.20.0",
    "@shopify/flash-list": "^1.4.3",
    "@stripe/stripe-react-native": "~0.35.1",
    "@tanstack/react-query": "4.29.15",
    "axios": "^1.4.0",
    "base64-arraybuffer": "^1.0.2",
    "date-fns": "^2.30.0",
    "expo": "^50.0.17",
    "expo-av": "^13.10.6",
    "expo-camera": "^14.1.3",
    "expo-location": "~16.5.3",
    "expo-notifications": "^0.27.7",
    "expo-secure-store": "^12.8.1",
    "expo-video-thumbnails": "^7.9.0",
    "ffmpeg-kit-react-native": "^5.1.0",
    "formik": "^2.4.2",
    "i18next": "^22.5.1",
    "react": "^18.2.0",
    "react-content-loader": "^6.2.1",
    "react-i18next": "^12.3.1",
    "react-native": "^0.74.1",
    "react-native-audio-recorder-player": "^3.6.7",
    "react-native-calendars": "^1.1299.0",
    "react-native-config": "^1.5.1",
    "react-native-create-thumbnail": "^2.0.0",
    "react-native-device-info": "^10.6.0",
    "react-native-document-picker": "^9.1.2",
    "react-native-file-access": "^3.1.0",
    "react-native-fs": "^2.20.0",
    "react-native-gesture-handler": "^2.14.1",
    "react-native-image-crop-picker": "^0.40.0",
    "react-native-image-picker": "^7.1.2",
    "react-native-inappbrowser-reborn": "^3.7.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-linear-gradient": "^2.8.3",
    "react-native-onesignal": "^4.5.1",
    "react-native-paper": "^5.12.3",
    "react-native-permissions": "^4.1.5",
    "react-native-reanimated": "^3.8.1",
    "react-native-safe-area-context": "^4.9.0",
    "react-native-screens": "^3.29.0",
    "react-native-splash-screen": "^3.3.0",
    "react-native-svg": "14.1.0",
    "react-native-svg-transformer": "^1.3.0",
    "react-native-text-input-mask": "^3.2.0",
    "react-native-vector-icons": "^9.2.0",
    "react-native-version-check": "^3.4.7",
    "react-native-video": "^5.2.1",
    "react-native-webview": "13.6.4",
    "use-debounce": "^9.0.4",
    "valtio": "^1.10.6",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native-community/eslint-config": "^3.2.0",
    "@tsconfig/react-native": "^2.0.2",
    "@types/jest": "^29.2.1",
    "@types/react": "~18.2.45",
    "@types/react-native-vector-icons": "^6.4.13",
    "@types/react-native-version-check": "^3.4.8",
    "@types/react-native-video": "^5.0.20",
    "@types/react-test-renderer": "^18.0.0",
    "@typescript-eslint/eslint-plugin": "^5.60.0",
    "@typescript-eslint/parser": "^5.60.0",
    "babel-jest": "^29.2.1",
    "babel-plugin-module-resolver": "^4.1.0",
    "eslint": "^8.19.0",
    "eslint-config-satya164": "^3.1.12",
    "eslint-plugin-simple-import-sort": "^8.0.0",
    "jest": "^29.2.1",
    "jest-config": "^29.2.1",
    "jest-expo": "^50.0.4",
    "metro-react-native-babel-preset": "^0.73.10",
    "prettier": "^2.8.8",
    "react-test-renderer": "^18.2.0",
    "typescript": "^5.3.0"
  },
  "jest": {
    "preset": "jest-expo",
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js",
      "jsx",
      "json",
      "node"
    ],
    "transformIgnorePatterns": [
      "node_modules/(?!react-native|react-navigation|jest-runner)/",
      "jest-runner"
    ]
  },
  "packageManager": "yarn@3.6.4"
}

What platform(s) does this occur on?

iOS

SDK Version

50.0.17

Environment

expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.2.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
Yarn: 3.6.4 - ~/.nvm/versions/node/v20.11.0/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm
Watchman: 2023.12.04.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.2 - /opt/homebrew/lib/ruby/gems/3.1.0/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
IDEs:
Xcode: 15.3/15E204a - /usr/bin/xcodebuild

Minimal reproducible example

link to prepared repo: https://github.com/marelix2/expo-example-error

  1. fetch it
  2. yarn install
  3. pod install
  4. go to xcode and build it
@marelix2 marelix2 added CLI Versioned Expo CLI -- `npx expo start` needs validation Issue needs to be validated labels May 6, 2024
@expo-bot expo-bot removed the needs validation Issue needs to be validated label May 6, 2024
@marelix2 marelix2 changed the title [expo-modules-core] error: exception specification of overriding function is more lax than base version [IOS][expo-modules-core] error: exception specification of overriding function is more lax than base version May 6, 2024
@aureosouza

This comment was marked as spam.

@byCedric byCedric added iOS Expo Modules Core needs review Issue is ready to be reviewed by a maintainer and removed CLI Versioned Expo CLI -- `npx expo start` labels May 6, 2024
@aronbraun
Copy link

same issue

@tsapeta
Copy link
Member

tsapeta commented May 7, 2024

Hello! This is a result of one of many breaking changes introduced in 0.74. Generally, Expo SDK 50 is not meant to be used with this version of React Native. We released SDK 51 just today, which officially supports React Native 0.74 and its bridgeless mode in the new architecture. I really recommend to upgrade to this new SDK 😉

If it's not yet feasible in your project to upgrade the SDK, the workaround for this specific error would be to patch-package this line by adding noexcept keyword, i.e.

- void invokeAsync(std::function<void()> &&func) override {
+ void invokeAsync(std::function<void()> &&func) noexcept override {

However, I can't guarantee that everything else will work properly with RN 0.74.

@JessedeJonge
Copy link

JessedeJonge commented May 8, 2024

I get the same error while using SDK 51 with the following package.json. So it does not seem to be resolved with the new SDK. I removed node modules and reinstalled (with bun):

    "@expo/vector-icons": "^14.0.0",
    "@hookform/resolvers": "^3.3.4",
    "@react-navigation/native": "^6.1.7",
    "@tanstack/react-query": "^5.29.2",
    "axios": "^1.6.8",
    "expo": "^51.0.0",
    "expo-constants": "~16.0.1",
    "expo-device": "~6.0.2",
    "expo-image-picker": "~15.0.4",
    "expo-linking": "~6.3.1",
    "expo-localization": "~15.0.3",
    "expo-notifications": "~0.28.1",
    "expo-router": "~3.5.9",
    "expo-splash-screen": "~0.27.4",
    "expo-status-bar": "~1.12.1",
    "expo-system-ui": "~3.0.4",
    "expo-web-browser": "~13.0.3",
    "i18next": "^23.7.20",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-hook-form": "^7.51.3",
    "react-i18next": "^14.0.1",
    "react-native": "0.74.1",
    "react-native-gesture-handler": "~2.16.1",
    "react-native-mmkv": "^2.12.2",
    "react-native-pager-view": "6.3.0",
    "react-native-reanimated": "3.10.0",
    "react-native-safe-area-context": "^4.8.2",
    "react-native-screens": "3.31.1",
    "react-native-unistyles": "^2.1.1",
    "react-native-web": "~0.19.10",
    "zod": "^3.22.5",
    "zod-i18n-map": "^2.27.0",
    "zustand": "^4.5.2"

@tsapeta
Copy link
Member

tsapeta commented May 8, 2024

@JessedeJonge Could you check which version of expo-modules-core gets installed in your project? You can do this with npm ls expo-modules-core or yarn why expo-modules-core.

@JessedeJonge
Copy link

JessedeJonge commented May 8, 2024

@tsapeta

npm ls expo-modules-core                      
mobile@1.0.0 
└─┬ expo@51.0.0
 └── expo-modules-core@1.11.13 overridden

Ah.. the issue was I had a overwrite hidden in my package.json for expo-modules-core. Not sure why/how that happened. Removed the overwrite, reinstalled and it's now working (with Expo SDK 51). Thank you.

@marelix2
Copy link
Author

marelix2 commented May 8, 2024

Same for me, issue were resolved with upgrade of SDK. Thanks

@aureosouza
Copy link

We tried upgrading to SDK 51, but on pod install getting:

The Swift pod `ExpoModulesCore` depends upon `React-jsinspector`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.

We do not use use_modular_headers! globally, what is best way to solve this?

@marelix2
Copy link
Author

marelix2 commented May 8, 2024

We tried upgrading to SDK 51, but on pod install getting:

The Swift pod `ExpoModulesCore` depends upon `React-jsinspector`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.

We do not use use_modular_headers! globally, what is best way to solve this?

you can try to add sth like this in your Podfile inside your common_pods or directly in target

pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text', :modular_headers => true

@marelix2 marelix2 closed this as completed May 8, 2024
@aureosouza
Copy link

@marelix2 thanks for that, it helped setting:

pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector-modern', :modular_headers => true

But I'm having problems with RCT-Folly now:

The Swift pod ExpoModulesCore depends upon RCT-Folly, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set use_modular_headers! globally in your Podfile, or specify :modular_headers => true for particular dependencies.

Setting the paths don't help:

pod 'RCT-Folly', :path => '../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec', :modular_headers => true

Getting error:

There are multiple dependencies with different sources for RCT-Folly in Podfile:

  • RCT-Folly
  • RCT-Folly (from ../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec)
  • RCT-Folly/Fabric (from ../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec)

@marelix2
Copy link
Author

marelix2 commented May 9, 2024

@aureosouza No clue what to do. Have you tried to remove Podfile.lock and Pods? It usually helps combined with update dependencies to latest.

@aureosouza
Copy link

@marelix2 yep did hard reset on everything, but still the same:

rm -rf package-lock.json && rm -rf node_modules && npm i && rm -rf /ios/Podfile.lock && rm -rf ~/Library/Preferences/com.apple.dt.Xcode.plist && rm -rf ~/Library/Caches/CocoaPods && rm -rf /ios/Pods && rm -rf ~/Library/Developer/Xcode/DerivedData && npx pod-install --repo-update

I might open a new issue on this, but thanks anyway.

@thomasflorian
Copy link

@aureosouza facing the same issue, did you ever figure it out?

@ampopdev
Copy link

@thomasflorian yes we solved it upgrading to latest expo 51 and ensuring you have in your Podfile:

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

Hope that helps you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Expo Modules Core iOS needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

9 participants