Gesture Handler Error ("react-native-gesture-handler": "~2.9.0")

Hi, I am Getting this issue => in locally the build was successful … but using EAS build android… getting error

[stderr] 
FAILURE: Build completed with 2 failures.
1363
[stderr] 
1: Task failed with an exception.
1364
[stderr] 
-----------
1365
[stderr] 
* What went wrong:
1366
[stderr] 
Execution failed for task ':react-native-gesture-handler:compileReleaseKotlin'.
1367
[stderr] 
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
1368
[stderr] 
   > Compilation error. See log for more details
1369
[stderr] 
* Try:
1370
[stderr] 
> Run with --stacktrace option to get the stack trace.
1371
[stderr] 
> Run with --info or --debug option to get more log output.
1372
[stderr] 
> Run with --scan to get full insights.
1373
[stderr] 
==============================================================================
1374
[stderr] 
2: Task failed with an exception.
1375
[stderr] 
-----------
1376
[stderr] 
* What went wrong:
1377
[stderr] 
java.lang.StackOverflowError (no error message)
1378
[stderr] 
* Try:
1379
[stderr] 
> Run with --stacktrace option to get the stack trace.
1380
[stderr] 
> Run with --info or --debug option to get more log output.
1381
[stderr] 
> Run with --scan to get full insights.
1382
[stderr] 
==============================================================================
1383
[stderr] 
* Get more help at https://help.gradle.org
1384
Execution optimizations have been disabled for 2 invalid unit(s) of work during this build to ensure correctness.
1385
Please consult deprecation warnings for more details.
1386
483 actionable tasks: 483 executed
1387
[stderr] 
BUILD FAILED in 6m 53s
1388
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.

@amit_nonceblox Did you ever figure out what was causing this issue? I’m also getting an EAS build error with react-native-gesture-handler@2.9.0 with expo@48.0.8 and wondering if it’s related to what you were experiencing or not. Getting the build error for both iOS and Android.

Here was the iOS error I was seeing:

:x: Metro encountered an error:
node_modules/react-native-gesture-handler/src/handlers/gestures/GestureDetector.tsx: /Users/expo/workingdir/build/node_modules/react-native-gesture-handler/src/handlers/gestures/GestureDetector.tsx: /Users/expo/workingdir/build/node_modules/react-native-gesture-handler/src/handlers/gestures/GestureDetector.tsx: helperSkipTransparentExpressionWrappers.skipTransparentExprWrapperNodes is not a function
Learn more: Troubleshooting build errors and crashes - Expo Documentation

And the Android build error:

788 [stderr]
Error: @build-script-error-begin
789 [stderr]
Error loading assets JSON from Metro. Ensure you’ve followed all expo-updates installation steps correctly. node_modules/react-native-gesture-handler/src/handlers/gestures/GestureDetector.tsx: /home/expo/workingdir/build/node_modules/react-native-gesture-handler/src/handlers/gestures/GestureDetector.tsx: /home/expo/workingdir/build/node_modules/react-native-gesture-handler/src/handlers/gestures/GestureDetector.tsx: helperSkipTransparentExpressionWrappers.skipTransparentExprWrapperNodes is not a function
790 [stderr]
@build-script-error-end
791[stderr]
at /home/expo/workingdir/build/node_modules/expo-updates/scripts/createManifest.js:59:11
792[stderr]
at processTicksAndRejections (node:internal/process/task_queues:96:5)

If you were able to get yours working, would love to known what you did so I can give it a try.

i expect this is likely related to the babel config in your project. are you using the expo preset or have you added some additional customizations?

Ah! That might be it @brents. I noticed when I tried to do a local build it added @babel/core (^7.20.0) as a dev dependency in my package.json, which I didn’t previously have. That wasn’t there as a dependency before and hasn’t been an issue over the past few years of using Expo. I noticed it’s there in the expo preset when creating a brand new expo project. I’ll try adding that and see if it resolves the issue. Interestingly, I was able to do a build a couple weeks ago (mid-March) and it worked fine without it. Will let you know if it resolves the issue! Appreciate the help!

What other devDependencies do you have? If it’s an old project you might have something like this instead:

  "devDependencies": {
    "babel-preset-expo": "^7.1.0"
  },

You can replace that with the appropriate version of @babel/core.

Thanks so much for your help @brents and @wodin! I added @babel/core as a dev dependency and the Android build worked. I haven’t tried iOS but assume it will be the same. I’ve never had babel-preset-expo as an explicit dev dependency. I have that in my .babelrc file though (along with react-native-reanimated/plugin as I use that in this project):

{
  "presets": [
    "babel-preset-expo"
  ],
  "plugins": [
    "react-native-reanimated/plugin"
  ]
}

I’ll probably switch that over to a babel.config.js file as that seems to be the more current way to configure things. Dumb question for you: if babel-preset-expo is being used in the babel config, does it not need to be an explicit dev dependency? I don’t know much about babel (or how the build process works under the hood), so just wondering.

It’s a dependency of expo:

1 Like

Oh that makes sense! Thanks for clarifying that @wodin!

1 Like