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

Incompatible with Expo SDK 50 #34

Closed
tomnoir opened this issue Jan 19, 2024 · 37 comments · Fixed by #33
Closed

Incompatible with Expo SDK 50 #34

tomnoir opened this issue Jan 19, 2024 · 37 comments · Fixed by #33

Comments

@tomnoir
Copy link

tomnoir commented Jan 19, 2024

Reason: MainActivity.java and MainApplication.java were migrated to Kotlin. If you use any config plugins that modify these files, they may need to be updated for SDK 50 support.

The WatermelonDB config plugin was specifically mentioned in the SDK 50 release notes: https://expo.dev/changelog/2024/01-18-sdk-50#%E2%9E%A1%EF%B8%8F-upgrading-your-app

@tomnoir
Copy link
Author

tomnoir commented Jan 19, 2024

Sorry, just saw that you already have a branch for this.

@tomnoir tomnoir closed this as completed Jan 19, 2024
@killerchip
Copy link
Contributor

killerchip commented Jan 19, 2024 via email

@killerchip killerchip reopened this Jan 19, 2024
@killerchip
Copy link
Contributor

I am re-opening the issue in case someone else has the issue also.
We have no released a beta version of this fix, for testing.

npm install @morrowdigital/watermelondb-expo-plugin@beta

@garygcchiu
Copy link

garygcchiu commented Jan 19, 2024

Thanks for updating! Unfortuantely this didn't end up working for me, I am on a M1 Mac:

➜ npx expo run:ios
✔ Created native directory
✔ Updated package.json | no changes
» ios: icon: This is the image that your app uses on your home screen, you will need to configure it manually.
✔ Finished prebuild
⚠️  Something went wrong running `pod install` in the `ios` directory.
Command `pod install` failed.
└─ Cause: No podspec found for `simdjson` in `../node_modules/@nozbe/simdjson`

pod install --repo-update --ansi exited with non-zero code: 1

I had this issue before with SDK49, which was resolved by adding this to my package.json:

    "@nozbe/simdjson": "^3.1.0-wmelon1",

However, if I add it back into my project on SDK50, I get this error:

➜ npx expo run:ios     
⚠️  Something went wrong running `pod install` in the `ios` directory.
Command `pod install` failed.
└─ Cause: There are multiple dependencies with different sources for `simdjson` in `Podfile`:

- simdjson (from `../../../node_modules/@nozbe/simdjson`)
- simdjson (from `../node_modules/@nozbe/simdjson`)

pod install --repo-update --ansi exited with non-zero code: 1

If I go to my /ios/Podfile and update the simdjson path to ../../../node_modules/@nozbe/simdjson, then I get a massive wall of red errors (containing some CompileC errors, WriteAuxiliaryFile, a bunch of environment variables exported CreateBuildDirectory errors, ect. at the bottom of which saying:

The following build commands failed:
        PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/me/Library/Developer/Xcode/DerivedData/project-dyuclkaxujwtozavxcxiiopuuyxk/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-rncore.build/Script-46EB2E0001F5E0.sh (in target 'React-rncore' from project 'Pods')
(1 failure)

My dependencies in my package.json:

  "dependencies": {
    "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
    "@gorhom/bottom-sheet": "^4",
    "@hookform/resolvers": "^3.3.4",
    "@morrowdigital/watermelondb-expo-plugin": "beta",
    "@nozbe/simdjson": "^3.1.0-wmelon1",
    "@nozbe/watermelondb": "^0.27.1",
    "@nozbe/with-observables": "^1.6.0",
    "@sentry/react-native": "5.16.0",
    "@shopify/flash-list": "^1.6.3",
    "app": "*",
    "db": "*",
    "dotenv": "^16.3.1",
    "expo": "^50.0.0",
    "expo-application": "~5.8.3",
    "expo-build-properties": "~0.11.0",
    "expo-constants": "~15.4.5",
    "expo-device": "~5.9.3",
    "expo-linking": "~6.2.2",
    "expo-router": "~3.4.3",
    "expo-splash-screen": "~0.26.3",
    "expo-status-bar": "~1.11.1",
    "lib": "*",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-hook-form": "^7.49.3",
    "react-native": "0.73.2",
    "react-native-calendars": "^1.1303.0",
    "react-native-dropdown-picker": "^5.4.6",
    "react-native-gesture-handler": "~2.14.0",
    "react-native-reanimated": "~3.6.0",
    "react-native-safe-area-context": "4.8.2",
    "react-native-screens": "~3.29.0",
    "react-native-web": "~0.19.6",
    "sentry-expo": "~7.0.0",
  },

Everything works fine again if I revert back to SDK49. I've tried deleting my node_modules and ios folder and re-running yarn install and npx expo run:ios. Anyone else running into a similar issue?

@killerchip
Copy link
Contributor

killerchip commented Jan 19, 2024

Hey @garygcchiu it seems that the podfile cannot find the simjson in node modules. Indeed very weird.
If you 'prebuild' (with version 50) do you see inside in your ios/Podfile:

# WatermelonDB dependency
    pod 'simdjson', path: '../node_modules/@nozbe/simdjson', modular_headers: true 

Because these are the official instructions.

Also I would suggest you try this. After install go and patch (with 'patch package`) the file in node_modules, the @morrowdigital/watermelondb-expo-plugin/build/withWatermelon.js

and inside the function:
withSDK50 change the line 267
from

currentConfig = cocoaPods(currentConfig);

to

currentConfig = withCocoaPods(currentConfig);

This is the old 'way' of setting up cocoapods (in SDK49). And since it works for you, it should work also for SDK50, since no change done in the iOS part.

Please let me know if this works, for you.

@HieronymusLex
Copy link

FWIW beta is working on Android for me with Expo 50

@garygcchiu
Copy link

garygcchiu commented Jan 19, 2024

@killerchip yeah, after I upgrade my expo to sdk50 & related packages (including "@morrowdigital/watermelondb-expo-plugin": "beta"), I deleted my ios folder and ran npx expo prebuild --platform ios. The prebuild fails:

➜ npx expo prebuild --platform ios                                                                              
✔ Created native directory
✔ Updated package.json | no changes
» ios: icon: This is the image that your app uses on your home screen, you will need to configure it manually.
✔ Finished prebuild
⚠️  Something went wrong running `pod install` in the `ios` directory.
Command `pod install` failed.
└─ Cause: There are multiple dependencies with different sources for `simdjson` in `Podfile`:

- simdjson (from `../../../node_modules/@nozbe/simdjson`)
- simdjson (from `../node_modules/@nozbe/simdjson`)

pod install --repo-update --ansi exited with non-zero code: 1

Inside my ios/Podfile, I have this:

    # WatermelonDB dependency
    pod 'simdjson', path: '../node_modules/@nozbe/simdjson', modular_headers: true      

Changing line 267 to currentConfig = withCocoaPods(currentConfig); would make the prebuild work!

➜ npx expo prebuild --platform ios
✔ Created native directory | reusing /ios
✔ Updated package.json | no changes
» ios: icon: This is the image that your app uses on your home screen, you will need to configure it manually.
✔ Finished prebuild

However, when trying to run my app, it still returns the same error as above:

➜ npx expo run:ios                
⚠️  Something went wrong running `pod install` in the `ios` directory.
Command `pod install` failed.
└─ Cause: There are multiple dependencies with different sources for `simdjson` in `Podfile`:

- simdjson (from `../../../node_modules/@nozbe/simdjson`)
- simdjson (from `../node_modules/@nozbe/simdjson`)

pod install --repo-update --ansi exited with non-zero code: 1

After the successful prebuild with the patched line, the contents of my ios/Podfile are now:

  pod 'WatermelonDB', :path => '../node_modules/@nozbe/watermelondb'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi', :modular_headers => true
  pod 'simdjson', path: '../node_modules/@nozbe/simdjson', :modular_headers => true

If the change the path for all three of these deps (if I just change one, then the others would give the same error) prepended with ../../, so the paths are now ../../../node_modules/etc., then pod install also succeeds, but I get the same giant red wall of errors like before.

Thanks for the help!

@garygcchiu
Copy link

If I actually remove "@nozbe/simdjson": "^3.1.0-wmelon1" from my package.json, and prebuild again, it gives a slightly different error:

➜ npx expo prebuild --platform ios
✔ Created native directory
✔ Updated package.json | no changes
» ios: icon: This is the image that your app uses on your home screen, you will need to configure it manually.
✔ Finished prebuild
⚠️  Something went wrong running `pod install` in the `ios` directory.
Command `pod install` failed.
└─ Cause: There are multiple dependencies with different sources for `WatermelonDB` in `Podfile`:

- WatermelonDB (from `../../../node_modules/@nozbe/watermelondb`)
- WatermelonDB (from `../node_modules/@nozbe/watermelondb`)

pod install --repo-update --ansi exited with non-zero code: 1

@garygcchiu
Copy link

garygcchiu commented Jan 19, 2024

If this helps too, I just tried a brand new npx create-expo-app project. The resulting package.json:

{
  "name": "expo-50-test",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@morrowdigital/watermelondb-expo-plugin": "^2.3.0",
    "@nozbe/simdjson": "^3.1.0-wmelon1",
    "@nozbe/watermelondb": "^0.27.1",
    "@nozbe/with-observables": "^1.6.0",
    "expo": "~50.0.2",
    "expo-status-bar": "~1.11.1",
    "react": "18.2.0",
    "react-native": "0.73.2"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },
  "private": true
}

Without specifying @nozbe/simdjson, the prebuild would fail saying "Unable to find a specification for simdjson depended upon by WatermelonDB".

After installing it, the pod install succeeds but then I get the same giant red wall of errors again.

The following build commands failed:
	PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/gary.chiu/Library/Developer/Xcode/DerivedData/expo50test-baebtfbebgweofbihmvoakkmnush/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-rncore.build/Script-46EB2E000183E0.sh (in target 'React-rncore' from project 'Pods')

@killerchip
Copy link
Contributor

Hey @garygcchiu I have updated the plugin with a newer version (-beta1).
Can you please try and see if you are still having issues?

yarn add morrowdigital/watermelondb-expo-plugin@beta

^2.3.0-beta1

@killerchip killerchip linked a pull request Jan 22, 2024 that will close this issue
@bamzi
Copy link

bamzi commented Jan 22, 2024

I confirm 2.3.0-beta1 works on iOS env. Caveat there will be issues if using existing DB or importing db file from assets folder. I think the new expo-file-system for getting file path of returns file:///Users/.... which is problematic and thus before using the path to db in new SQLiteAdapter ensure to remove "file://"

Example:

const adapter = new SQLiteAdapter({
    schema: schemaFile,
    dbName: dbPath.replace("file://", ""),
});

@garygcchiu
Copy link

@bamzi nice! are you also on a Apple Silicon machine?

Unfortuately I'm still getting a giant wall of red errors even with 2.3.0-beta1. If it's also working for you on Apple Silicon then perhaps my errors are just something wrong with my XCode or something. I'm trying this in the above new npx create-expo-app project, same package.json except with "@morrowdigital/watermelondb-expo-plugin": "2.3.0-beta1",.

@killerchip
Copy link
Contributor

killerchip commented Jan 22, 2024

@bamzi nice! are you also on a Apple Silicon machine?

Unfortuately I'm still getting a giant wall of red errors even with 2.3.0-beta1. If it's also working for you on Apple Silicon then perhaps my errors are just something wrong with my XCode or something. I'm trying this in the above new npx create-expo-app project, same package.json except with "@morrowdigital/watermelondb-expo-plugin": "2.3.0-beta1",.

Hey @garygcchiu
I have tried the above with eas build (online) and I understand that it is using M1 by default. And I had no issue building a vanilla create-expo-app. (I built an 'internal distribution' package.

Can you try please the same with a vanilla create expo app?
If builds online and not offline, then probably something with your installation.
I guess

P.S. (And throw a --clear-cache in the equation to be sure)

@bamzi
Copy link

bamzi commented Jan 22, 2024

@garygcchiu Not tested on M1, I'm using Intel based CPU but I have an M1 laptop that I will try later today.

FYI, As soon as I attempted the SDK-50 upgrade process I had a lot of issues with ios prebuild and had to update my OS, XCode and Simulator to latest versions. I also had to go through package upgrades as well, not just expo-doctor but slightly more.

Some notables updates in package.json

"dependencies": {
    "@expo/metro-config": "^0.17.3",
    "expo-asset": "~9.0.2",
    "expo-build-properties": "~0.11.0",
    "expo-file-system": "~16.0.4",
    "expo-font": "~11.10.2",
    "expo-linking": "~6.2.2",
    "expo-localization": "~14.8.3",
    "expo-router": "latest",
    "expo-splash-screen": "~0.26.3",
    "expo-sqlite": "~13.2.1",
    "expo-status-bar": "~1.11.1",
    "expo-system-ui": "~2.9.3",
    "expo-web-browser": "~12.8.1",
},
"devDependencies": {
   "@expo/prebuild-config": "latest",
   "metro-react-native-babel-preset": "^0.77.0",
},

@killerchip
Copy link
Contributor

@garygcchiu Not tested on M1, I'm using Intel based CPU but I have an M1 laptop that I will try later today.

FYI, As soon as I attempted the SDK-50 upgrade process I had a lot of issues with ios prebuild and had to update my OS, XCode and Simulator to latest versions. I also had to go through package upgrades as well, not just expo-doctor but slightly more.

Some notables updates in package.json

"dependencies": {
    "@expo/metro-config": "^0.17.3",
    "expo-asset": "~9.0.2",
    "expo-build-properties": "~0.11.0",
    "expo-file-system": "~16.0.4",
    "expo-font": "~11.10.2",
    "expo-linking": "~6.2.2",
    "expo-localization": "~14.8.3",
    "expo-router": "latest",
    "expo-splash-screen": "~0.26.3",
    "expo-sqlite": "~13.2.1",
    "expo-status-bar": "~1.11.1",
    "expo-system-ui": "~2.9.3",
    "expo-web-browser": "~12.8.1",
},
"devDependencies": {
   "@expo/prebuild-config": "latest",
   "metro-react-native-babel-preset": "^0.77.0",
},

Officially after the upgrade you have to run npx expo install --fix so it upgrades packages.

@garygcchiu
Copy link

@killerchip I think eas build requires an Apple Developer account right? I don't have one setup yet, and it seems to be a required step

If it works for your eas build and for @bamzi's M1 later, happy to chalk up my issue to something with my installation and to not block this.

@killerchip
Copy link
Contributor

@garygcchiu yes it requires an account in order to create provisioning profiles.
Have you also tried npx expo run:ios?

@garygcchiu
Copy link

yep, my issue occurs when executing npx expo run:ios.

The ending of the wall of errors:

note: Run script build phase '[Expo] Configure project' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'expo50test' from project 'expo50test')
note: Run script build phase 'Bundle React Native code and images' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'expo50test' from project 'expo50test')
warning: 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')
warning: Run script build phase '[CP-User] [Hermes] Replace Hermes for the right configuration, if needed' 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 'hermes-engine' from project 'Pods')


--- xcodebuild: WARNING: Using the first of multiple matching destinations:
{ platform:iOS Simulator, id:22B8E063-ACA3-46A4-B9C1-CED737D8AAD4, OS:17.2, name:iPhone 15 }
{ platform:iOS Simulator, id:22B8E063-ACA3-46A4-B9C1-CED737D8AAD4, OS:17.2, name:iPhone 15 }
** BUILD FAILED **


The following build commands failed:
	PhaseScriptExecution [CP-User]\ Generate\ Specs /Users/gary.chiu/Library/Developer/Xcode/DerivedData/expo50test-baebtfbebgweofbihmvoakkmnush/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-rncore.build/Script-46EB2E000183E0.sh (in target 'React-rncore' from project 'Pods')
(1 failure)
Build logs written to /Users/gary.chiu/Projects/expo-50-test/.expo/xcodebuild.log

I'll keep exploring this, since it seems others have ran into this issue in previous SDK upgrades. Likely just an issue w/ my installation

@bamzi
Copy link

bamzi commented Jan 23, 2024

After a lot tinkering, I've managed to get things to work on Mac M1. Here are the things I had to do and modify.

** Specially check the last part on ARM being apart of excluded architectures

Version check:

Sonoma 14.2.1
Xcode 15.2
Ruby 3.1.4
Pod 1.14.3
Node 18+
 // Global packages installed
 // nom i -g ….
     eas-cli@7.0.0
     expo-cli@6.3.10

Properly install Ruby 3.1.4

// To install ruby 3.1.4
>> brew install ruby@3.1
>> brew list ruby <— to confirm
>> ruby -v  <— ensure ruby 3.1.4 is installed
>> zsh <— reset shell incase another ruby version is showing
>> echo 'export PATH="/opt/homebrew/opt/ruby@3.1/bin:$PATH"' >> ~/.zshrc

// This part is weird but somehow it worked for me
>> sudo gem uninstall cocoapods
>> sudo gem uninstall ffi
// install cocoapods with brew
>> brew install cocoapods
// I had a weird issue with “acv-keywords”
// in the root of your project app
>> npm list ajv
// if issues with "ajv-keywords" comes up then do this:
>> [bun, npm, pnpm, yarn] add -d ajv@8.12
// Xcode problems:
// assuming you've run "xcode-select --install" before
// switching the source to app container
>> sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
>> sudo xcodebuild -license

// FINAL PART
// Somehow "arm64" is apart of "Exclude Architecture"
// In Xcode > app > builds ... check to make sure ARM is NOT apart of the excluded architectures.

Link to thread on fixing exclude architecture

If you're getting some errors on JSX or Babel, you need to update @babel/core & @babel/runtime

@bamzi
Copy link

bamzi commented Jan 23, 2024

Update: I tried expo run:ios --no-build-cache this morning, and i get the following errors. FYI I haven't been able to update WatermelonDB yet, just that the pods compile and parts of the app comes up

Compiling JS failed: 67529:3:export declaration must be at top level of module Buffer size 11730760 starts with: 766172205f5f42554e444c455f535441

RCTFatal
__28-[RCTCxxBridge handleError:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_drain
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
-[UIApplication _run]
UIApplicationMain
main
start_sim
0x0
0x0


@killerchip
Copy link
Contributor

Check if you can patch-package the changes in the following PR and if this solves your issues with expo run:ios,

https://github.com/morrowdigital/watermelondb-expo-plugin/pull/24/files

@bamzi
Copy link

bamzi commented Jan 24, 2024

Sorry for the delay. I confirm just 2.3.0-beta1 works on Mac M1 without the pull/24/files patch

However, I could not make it work on existing repo upgraded to SDK 50 and instead, as a way of trying to figure out what's going on, i created a new bunx create-expo-app -t with navigation/ts option and slowly moved files and packages over to the new project. I moved 100% of files and 100% packages and what's interesting is that my old repo doesn't work and yet the new project works perfectly! 🥴

Step to build slowly:

> bunx create-expo-app -t

# level 1 "start"
> bun install
> bun expo prebuild --clean
##>>> While PREBUILD is running, you have to jump into xcode and remove ARM from excluded architectures
# xcode > app > build settings > excluded architectures << remove "arm"
# if you see an error during prebuild is likely due to the architecture issue
> cd ios && pod install --repo-update && cd ..
> bun expo run ios

# after each change like adding packages to package.json or adding files to directories
# remove all the generated file and start from scratch
> rm -rf ios android bun.lockb node-modules .expo
# go up to > level 1 "start" and repeat
##!!! don't move all files and packages all at once or you risk a breaking change

here's my package.json dependencies:

"dependencies": {
    "@bufbuild/protobuf": "^1.6.0",
    "@connectrpc/connect": "^1.3.0",
    "@expo/metro-config": "^0.17.3",
    "@expo/vector-icons": "14",
    "@gorhom/bottom-sheet": "^4.6.0",
    "@morrowdigital/watermelondb-expo-plugin": "2.3.0-beta1",
    "@nozbe/watermelondb": "^0.27.1",
    "@nozbe/with-observables": "^1.6.0",
    "@react-native-masked-view/masked-view": "^0.3.1",
    "@react-navigation/bottom-tabs": "^6.5.11",
    "@react-navigation/drawer": "^6.6.6",
    "@react-navigation/native": "^6.1.9",
    "@react-navigation/native-stack": "^6.9.17",
    "@react-navigation/stack": "^6.3.20",
    "@shopify/flash-list": "^1.6.3",
    "@shopify/restyle": "^2.4.2",
    "@tanstack/react-query": "^5.17.19",
    "@xstate/react": "^4.0.3",
    "app-icon-badge": "^0.0.15",
    "color-hash": "^2.0.2",
    "expo": "^50.0.3",
    "expo-asset": "^9.0.2",
    "expo-build-properties": "^0.11.0",
    "expo-file-system": "^16.0.5",
    "expo-font": "^11.10.2",
    "expo-linking": "^6.2.2",
    "expo-localization": "^14.8.3",
    "expo-router": "^3.4.5",
    "expo-splash-screen": "^0.26.3",
    "expo-sqlite": "^13.2.1",
    "expo-status-bar": "^1.11.1",
    "expo-system-ui": "^2.9.3",
    "expo-web-browser": "^12.8.1",
    "fast-text-encoding": "^1.0.6",
    "fuzzysort": "^2.0.4",
    "graphemer": "^1.4.0",
    "lodash-es": "^4.17.21",
    "luxon": "^3.4.4",
    "rc-field-form": "^1.41.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "^0.73.2",
    "react-native-avoid-softinput": "^5.0.0",
    "react-native-config": "^1.5.1",
    "react-native-countdown-circle-timer": "^3.2.1",
    "react-native-country-flag": "^2.0.2",
    "react-native-drawer-layout": "^3.2.2",
    "react-native-gesture-handler": "^2.14.1",
    "react-native-linear-gradient": "^2.8.3",
    "react-native-mmkv": "^2.11.0",
    "react-native-pager-view": "^6.2.3",
    "react-native-reanimated": "^3.6.1",
    "react-native-redash": "^18.1.3",
    "react-native-safe-area-context": "^4.8.2",
    "react-native-screens": "^3.29.0",
    "react-native-shadow-2": "^7.0.8",
    "react-native-svg": "^14.1.0",
    "react-native-url-polyfill": "^2.0.0",
    "react-native-web": "^0.19.10",
    "react-native-webview": "^13.6.4",
    "react-svg-main": "^4.0.1",
    "resolve-from": "^5.0.0",
    "rgb-hex": "^4.1.0",
    "superjson": "^2.2.1",
    "xstate": "^5.5.2",
    "zod": "^3.22.4"
  },
  "devDependencies": {
    "@babel/core": "^7.23.7",
    "@babel/plugin-proposal-decorators": "^7.23.7",
    "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
    "@babel/plugin-transform-react-jsx": "^7.23.4",
    "@babel/preset-react": "^7.23.3",
    "@expo/prebuild-config": "^6.7.4",
    "@ianvs/prettier-plugin-sort-imports": "^4.1.1",
    "@react-native/babel-preset": "^0.73.19",
    "@tanstack/eslint-plugin-query": "^5.17.20",
    "@types/babel__core": "^7.20.5",
    "@types/eslint": "^8.56.2",
    "@types/luxon": "^3.4.2",
    "@types/react": "^18.2.48",
    "@typescript-eslint/eslint-plugin": "^6.19.1",
    "@typescript-eslint/parser": "^6.19.1",
    "ajv": "^8.12.0",
    "autoprefixer": "^10.4.17",
    "cross-env": "^7.0.3",
    "eslint": "^8.56.0",
    "eslint-config-prettier": "^9.1.0",
    "eslint-plugin-import": "^2.29.1",
    "eslint-plugin-jsx-a11y": "^6.8.0",
    "eslint-plugin-react": "^7.33.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "jest": "^29.7.0",
    "jest-expo": "^50.0.1",
    "prettier": "^3.2.4",
    "react-native-mmkv-flipper-plugin": "^1.0.0",
    "react-native-svg-transformer": "^1.3.0",
    "react-test-renderer": "^18.2.0",
    "typescript": "^5.3.3"
  },

My babel.config.js

/** @type {import("@babel/core").ConfigFunction} */
module.exports = function (api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: [
      require.resolve("react-native-reanimated/plugin"),
      "@babel/plugin-proposal-export-namespace-from",
      ["@babel/plugin-proposal-decorators", { legacy: true }],
    ],
  };
};

and app.config.ts or app.json

plugins: [
    [
      "expo-font",
      {
        // "fonts": ["path/to/file.ttf"] 
        fonts: [...]
      },
    ],
    "./expo-plugins/with-modify-gradle.js",
    ["@morrowdigital/watermelondb-expo-plugin"],
    [
      "expo-build-properties",
      {
        android: {
          kotlinVersion: "1.8.10",
          extraProguardRules: "-keep class com.nozbe.watermelondb.** { *; }",
          packagingOptions: {
            pickFirst: ["**/libc++_shared.so"],
          },
        },
        ios: {
          extraPods: [],
        },
      },
    ],
    "expo-localization",
    "expo-router",
    
  ],
...

@rohankm
Copy link

rohankm commented Jan 25, 2024

hi is the beta version include JSI?

@killerchip
Copy link
Contributor

killerchip commented Jan 25, 2024 via email

@killerchip
Copy link
Contributor

killerchip commented Jan 29, 2024

v2.3.0-beta2 is now published.
It makes the ExcludeArchs insert optional.

Details:

`5532fc4

Install: npm install @morrowdigital/watermelondb-expo-plugin@beta

@FarahWe
Copy link

FarahWe commented Jan 29, 2024

@killerchip i'm using your new version with excludeSimArch on my M2 apple sillicon, and i`m facing this error

could not find module 'ExpoModulesCore' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator,

@killerchip
Copy link
Contributor

killerchip commented Jan 29, 2024 via email

@FarahWe
Copy link

FarahWe commented Jan 30, 2024

@FarahWe
If you don’t add the option?

On Mon, 29 Jan 2024 at 19:20, Eduardo Farah @.***>
wrote:

@killerchip https://github.com/killerchip i'm using your new version
with excludeSimArch on my M2 apple sillicon, and i`m facing this error

could not find module 'ExpoModulesCore' for target
'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator,


Reply to this email directly, view it on GitHub
#34 (comment),
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AELMPHTJCLVEUVIDTLG66P3YQ7K5JAVCNFSM6AAAAABCB67RG6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJVGIYTAMJUHA
.
You are receiving this because you were mentioned.Message ID:
@.***>

I remove the plug-in option and worked! Thanks

@garygcchiu
Copy link

garygcchiu commented Jan 31, 2024

I can confirm this is working on Intel Macs -- I was able to get https://github.com/morrowdigital/watermelondb-plugin-example up and running.

I cannot for the life of me figure out why this is not working for me on my M1 Mac. The steps I took on my M1 Mac are identical to what I did on my Intel Mac:

git clone git@github.com:morrowdigital/watermelondb-plugin-example.git
cd watermelondb-plugin-example
npm i (also tried with yarn)
npx expo run:ios

If I add the excludeSimArch option, I get "could not find module 'ExpoModulesCore' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator" as mentioned above.

If I remove the excludeSimArch option, I get the same giant wall of errors again. I've attached the errors here if anyone could help, I would appreciate it 🙏🏻 . I've dug online and tried the suggestions of removing my nvm, resetting my XCode, etc.

Log:
xcodebuild.log

Specs:

  • M1 Max
  • XCode 15.2
  • Node 20.11.0

@garygcchiu
Copy link

Oddly enough, it does work if I:

npx expo run:ios
get wall of errors
open ios/wmdbpluginexample.xcworkspace in XCode
click Run button, successful build -> opens iPhone Simulator, but would fail since bundler is not running
Start Metro Bundler via npx expo start
Reload app in iPhone Simulator -> works

🤔, no idea why this works, and if I run npx expo run:ios again, it still fails with the same errors.

@killerchip
Copy link
Contributor

killerchip commented Jan 31, 2024 via email

@garygcchiu
Copy link

Thanks! interestingly, it did work if I used:

eas.json:

"development-simulator": {
      "developmentClient": true,
      "distribution": "internal",
      "ios": {
        "simulator": true
      }
    },

Ran:

eas build --profile development-simulator --platform ios

Maybe my understanding is off. I assumed that npx expo run:ios was already building a development client, and eas build ... was basically just running the same command, just in the cloud.

Either way, seems I'm unblocked now. Thank you so much!

@killerchip
Copy link
Contributor

@garygcchiu Most probably it's your local XCode installation.

@yamadaOliva
Copy link

TypeError: Cannot read property 'initializeJSI' of null, js engine: hermes
what was wrong ??
// my version
{
"name": "vietlac-salerep-app",
"main": "expo-router/entry",
"version": "1.0.0",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"test": "jest --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/vector-icons": "^14.0.0",
"@morrowdigital/watermelondb-expo-plugin": "^2.3.1",
"@nozbe/watermelondb": "^0.27.1",
"@react-navigation/native": "^6.0.2",
"@reduxjs/toolkit": "^2.2.1",
"@supabase/supabase-js": "^2.39.7",
"axios": "^1.6.7",
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
"expo": "~50.0.11",
"expo-build-properties": "~0.11.1",
"expo-font": "~11.10.3",
"expo-linking": "~6.2.2",
"expo-router": "~3.4.7",
"expo-splash-screen": "~0.26.4",
"expo-status-bar": "~1.11.1",
"expo-system-ui": "~2.9.3",
"expo-web-browser": "~12.8.2",
"lodash": "^4.17.21",
"nativewind": "^2.0.11",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.73.4",
"react-native-safe-area-context": "4.8.2",
"react-native-screens": "~3.29.0",
"react-native-swipe-gestures": "^1.0.5",
"react-native-web": "~0.19.6",
"react-redux": "^9.1.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@types/lodash": "^4.14.202",
"@types/react": "~18.2.45",
"@types/react-native-dotenv": "^0.2.2",
"jest": "^29.2.1",
"jest-expo": "~50.0.3",
"react-test-renderer": "18.2.0",
"tailwindcss": "^3.3.2",
"typescript": "^5.1.3"
},
"private": true
}

@killerchip
Copy link
Contributor

@yamadaOliva
What platform you are having the problem with?
Do you use a monorepo?
You try to run it or build ?

@mattwhetton
Copy link

mattwhetton commented Apr 7, 2024

I am also getting the TypeError: Cannot read property 'initializeJSI' of null, js engine: hermes error mentioned above.

I get this on the CLI using simply expo start --ios:

iOS Bundled 7103ms (node_modules/expo/AppEntry.js)
 ERROR  TypeError: Cannot read property 'initializeJSI' of null, js engine: hermes
 ERROR  Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called., js engine: hermes

I'm on Mac M1, deploying to iOS simulator (iPhone 15).

I've tried the latest release and the beta packages but with the same errors

Is this a related issue or do I need to create a new issue?

@mattwhetton
Copy link

Ignore my last comment - just realised this wont work with expo go so switched to easbuild and got it working fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants