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

react-native-gesture-handler module was not found. Make sure you're running your app on the native platform and your code is linked properly (cd ios && pod install && cd ..) #9385

Closed
MaxCode-fan opened this issue Mar 5, 2021 · 37 comments

Comments

@MaxCode-fan
Copy link

Hello, what I want to know is why this problem appears after I operate according to the document. I don't know how to solve it.
image

image
My running platform is Win10 and Android mobile phone
image
Now I can't click on my screen anymore and it doesn't do anything

@github-actions
Copy link

github-actions bot commented Mar 5, 2021

Couldn't find version numbers for the following packages in the issue:

  • @react-navigation/native

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

@raajnadar
Copy link
Member

Did you follow the whole setup? https://reactnavigation.org/docs/getting-started#installing-dependencies-into-a-bare-react-native-project

Especially did you add this piece of code on your root file.

import 'react-native-gesture-handler';

@github-actions
Copy link

Hey! Thanks for opening the issue. Can you provide a minimal repro which demonstrates the issue? Posting a snippet of your code in the issue is useful, but it's not usually straightforward to run. A repro will help us debug the issue faster. Please try to keep the repro as small as possible and make sure that we can run it without additional setup.

The easiest way to provide a repro is on snack.expo.io. If it's not possible to repro it on snack.expo.io, then please provide the repro in a GitHub repository.

@github-actions
Copy link

Hello 👋, this issue has been open for more than a month without a repro or any activity. If the issue is still present in the latest version, please provide a repro or leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution or workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix it.

@github-actions
Copy link

github-actions bot commented Jul 7, 2021

Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.

@khdealwis
Copy link

@MaxCode-fan did you find any solution for this?

@suvinrj
Copy link

suvinrj commented Oct 3, 2022

Same for me. Did you find any solution?

@privatepej
Copy link

any solution guys?

@praveenreddy9
Copy link

praveenreddy9 commented Oct 25, 2022

Hello,

"react": "18.1.0",
"react-native": "^0.70.3",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4",
"react-native-gesture-handler": "^2.7.1",

Am using all the above versions still facing the below issue,
Please help me in resolving the issue or suggest me an alternate solution.

Simulator Screen Shot - iPhone 14 Pro Max - 2022-10-25 at 15 36 24
Screenshot 2022-10-25 at 2 47 05 PM
Simulator Screen Shot - iPhone 14 Pro Max - 2022-10-25 at 14 40 59

**ERROR [react-native-gesture-handler] react-native-gesture-handler module was not found. Make sure you're running your app on the native platform and your code is linked properly (cd ios && pod install && cd ..).

For installation instructions, please refer to https://docs.swmansion.com/react-native-gesture-handler/docs/#installation**

Thanks

@TacticCoder
Copy link

Same here

@Jim97M
Copy link

Jim97M commented Jan 4, 2023

Getting this error too, Did you find any solution?

@phongbksneep
Copy link

image

Same for me

@UchihaSV
Copy link

Same here, i installed by instructions and it's work for expo, but doesn't work for EJECT'ed Expo project, clean cache reinstall do not help, any advice?

@phongbksneep
Copy link

Does anyone have the workaround ? please

@phongbksneep
Copy link

I change getPackages in MainApplication like this:
@Override protected List<ReactPackage> getPackages() { List<ReactPackage> packages = new PackageList(this).getPackages(); return packages; }

@Juman8
Copy link

Juman8 commented Jan 12, 2023

Hi. make sure you are using match the config in MainApplication.java
I worked with @phongbksneep and I discovered that some projects after initialization will have a different format than the desired config that the bridge wants
Ex:
@Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new ... ); }
but the config have to be:
@Override protected List<ReactPackage> getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List<ReactPackage> packages = new PackageList(this).getPackages(); return packages; }
Because your app will not load all the other modules instead of adding it will return a new list with the elements in the returned array.
Hope it helps you.

@ashwindatye
Copy link

@Juman8 @phongbksneep Did u solve your problem? My config is like yours. I am still getting same error.
[react-native-gesture-handler] react-native-gesture-handler module was not found. Make sure you're running your app on the native platform and your code is linked properly (cd ios && pod install && cd ..).

For installation instructions, please refer to https://docs.swmansion.com/react-native-gesture-handler/docs/#installation
ERROR Invariant Violation: new NativeEventEmitter() requires a non-null argument., js engine: hermes

I have migrated from 0.63 to 0.70 and also from Intel Mac to M1

~ashwin

@Juman8
Copy link

Juman8 commented Jan 16, 2023

@Juman8 @phongbksneep Did u solve your problem? My config is like yours. I am still getting same error. [react-native-gesture-handler] react-native-gesture-handler module was not found. Make sure you're running your app on the native platform and your code is linked properly (cd ios && pod install && cd ..).

For installation instructions, please refer to https://docs.swmansion.com/react-native-gesture-handler/docs/#installation ERROR Invariant Violation: new NativeEventEmitter() requires a non-null argument., js engine: hermes

I have migrated from 0.63 to 0.70 and also from Intel Mac to M1

~ashwin

hi @ashwindatye
Is your metro path running and connecting?
As I can see, your code seems to be dead at the JS and get data from bridge layers, right?

@Kamlesh-62
Copy link

Kamlesh-62 commented Feb 17, 2023

react-native-gesture-handler module was not found. Make sure you're running your app on the native platform and your code is linked properly (cd ios && pod install && cd ..).

For installation instructions, please refer to https://docs.swmansion.com/react-native-gesture-handler/docs/#installation
[Fri Feb 17 2023 11:13:51.135] ERROR Invariant Violation: Native module cannot be null.
[Fri Feb 17 2023 11:13:51.135] ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

Hello, I am struggling with this error for the last 2 days. I have tried many solutions and suggestions from GitHub and StackOverflow, however, I did not get a solution.

"react": "16.9.0",
"react-native": "^0.63.3",
"@react-navigation/native": "^5.9.4",
"react-native-gesture-handler": "^1.10.3",
"react-native-reanimated": "^1.13.3",
"react-native-screens": "^2.18.1",
"@react-navigation/stack": "^5.14.4",
"@react-navigation/drawer": "^5.12.5",

Even I uninstall react-native-gesture-handler from the package from the project still not working. I used this command npm uninstall @react-native-gesture-handler --save.

Still I am getting same error

Some solution says link project, but RN version is higher than 0.60 so I need to do that right!

I'll appreciate your solution.

@DavidGracias
Copy link

I am getting the same exact issues as above -- please someone who knows how to solve this contact me!

@ubugnu
Copy link

ubugnu commented Feb 27, 2023

Solution: rebuild the app, for example yarn android.

@sgrund14
Copy link

think I tried everything on here and I'm still getting this same error... in addition to this:

ERROR Invariant Violation: new NativeEventEmitter() requires a non-null argument., js engine: hermes

I'm using expo in a Yarn workspace... has anyone solved this? Seems similar to what you were getting @ashwindatye

@JS-GitRepo
Copy link

JS-GitRepo commented Apr 7, 2023

@sgrund14

I'm using EAS Development Builds, but building the application resolved the "module not found" issue for me. For testing on android, the command was "eas build --profile development --platform android" ; I assume the ios equivalent may help if youre testing there. In a non-eas environment, it may be something like expo prebuild or some other experimentation with building your project might help.

Using React Navigation, wrapping my component prop in gestureHandlerRootHOC() solved my other issues. Screen components in the NavigationContainer looks something like this:

<Stack.Screen name="Home" component={gestureHandlerRootHOC(Home)} options={{ headerShown: false }} />

@crimson-med
Copy link

Same issue here:

{
  "dependencies": {
    "@expo/vector-icons": "^13.0.0",
    "@react-native-async-storage/async-storage": "1.17.11",
    "@react-native-community/checkbox": "^0.5.15",
    "@react-native-community/masked-view": "0.1.11",
    "@react-navigation/bottom-tabs": "6.5.7",
    "@react-navigation/native": "~6.1.6",
    "@react-navigation/stack": "~6.3.16",
    "axios": "^1.4.0",
    "expo": "~48.0.16",
    "expo-asset": "~8.9.1",
    "expo-constants": "~14.2.1",
    "expo-font": "~11.1.1",
    "expo-linking": "~4.0.1",
    "expo-splash-screen": "~0.18.2",
    "expo-status-bar": "~1.4.4",
    "expo-web-browser": "~12.1.1",
    "overmind": "^28.0.2",
    "overmind-react": "^29.0.2",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.71.7",
    "react-native-appearance": "~0.3.3",
    "react-native-dialog": "^9.3.0",
    "react-native-gesture-handler": "~2.9.0",
    "react-native-reanimated": "~2.14.4",
    "react-native-safe-area-context": "4.5.0",
    "react-native-screens": "~3.20.0",
    "react-native-web": "~0.18.10",
    "socket.io-client": "^4.6.1"
  },
  "devDependencies": {
    "@babel/core": "^7.21.8",
    "@types/node": "^18.16.3",
    "@types/react": "~18.2.4",
    "@types/react-native": "~0.71.6",
    "jest-expo": "~48.0.2",
    "typescript": "^5.0.4"
  },
}

Error:

Android Bundling failed 2926ms
Unable to resolve module react-native-gesture-handler from /react-native-overmind-boilerplate/App.tsx: react-native-gesture-handler could not be found within the project or in these directories:
  node_modules
  ../node_modules
  ../../node_modules

I have tried the following:

  • Clear cache and restart
  • Delete the node modules and re-install
  • Delete react-native-gesture-handler and reinstall.

Nothing seems to get rid of this issue.

@robdubparker
Copy link

@sgrund14

I'm using EAS Development Builds, but building the application resolved the "module not found" issue for me. For testing on android, the command was "eas build --profile development --platform android" ; I assume the ios equivalent may help if youre testing there. In a non-eas environment, it may be something like expo prebuild or some other experimentation with building your project might help.

Using React Navigation, wrapping my component prop in gestureHandlerRootHOC() solved my other issues. Screen components in the NavigationContainer looks something like this:

<Stack.Screen name="Home" component={gestureHandlerRootHOC(Home)} options={{ headerShown: false }} />

This is what solved it for me, at least on an IOS device (eas build + wrapping gestureHandlerRootHOC function around my screen components).

@HeyItsJs
Copy link

Hey @crimson-med, I am getting exact same error as you. Did you find any solution for it?

@RostCode78
Copy link

Yo aplique la vieja confiable, borrar node_modules y ejecutar npm install.

I applied "Old Reliable", delete node_modules and run npm install

@itheakmal
Copy link

i got issue of some folder not deleting in the build, and build failded, so delted those folder manually then rebuild all fixed

@danandres281
Copy link

import 'react-native-gesture-handler';
i have the same issue, how i fixed, i try deleting the pods and podfile then re installing again but not works, any solution ?

@rustyonrampage
Copy link

rustyonrampage commented Sep 26, 2023

I had this issue with the latest packages on rn cli.
ERROR [react-native-gesture-handler] react-native-gesture-handler module was not found.

So I looked in to it and found out for newer versions we need to wrap root view with GestureHandlerRootView.
https://docs.swmansion.com/react-native-gesture-handler/docs/1.10.3/
But even that didn't fix the issue and now I was having another error as well. "GestureHandlerRootView" was not found in the UIManager.

So I though maybe I should try with fresh node_modules.

  1. First I deleted node_modules folder
  2. Deleted package.lock/yarn.lock
  3. Cleared yarn cache.
  4. Installed the packages again using yarn command
  5. When I ran "yarn android". Everything was working fine.

Maybe following it'll help you guys.

(I'd suggest to use yarn package manager, I think originally issue started when I was installed a package using npm and I gave some dependency error and I did "npm install react-native-gesture-handler --force")

@Avetyandav
Copy link

Hey everyone!
Have the same issue with expo app, in Expo GO everything works amazing, after

eas build --profile development --platform iOS

Start having that gesture-handler problem.
Even after building empty(new) Expo project and trying to make dev build, have that problem, a soon as I add some navigation to the app.

@alemachado24
Copy link

Agree! Works perfectly after re building the project

npx eas-cli build --profile development

npx run start

@gibo77
Copy link

gibo77 commented Jan 2, 2024

I have the same issue after installing the react-native-splash-screen and did some changes on the Android files.
I did Rebuild Project in Android Studio and Re-install Gesture-handler, with no luck.

@AngCosmin
Copy link

I managed to solve the issue by following these installation steps

npm install --save react-native-gesture-handler
import { GestureHandlerRootView } from 'react-native-gesture-handler';

export default function App() {
  return (
    <GestureHandlerRootView style={{ flex: 1 }}>
      {/* content */}
    </GestureHandlerRootView>
  );
}

@WarutereD
Copy link

@sgrund14

I'm using EAS Development Builds, but building the application resolved the "module not found" issue for me. For testing on android, the command was "eas build --profile development --platform android" ; I assume the ios equivalent may help if youre testing there. In a non-eas environment, it may be something like expo prebuild or some other experimentation with building your project might help.

Using React Navigation, wrapping my component prop in gestureHandlerRootHOC() solved my other issues. Screen components in the NavigationContainer looks something like this:

<Stack.Screen name="Home" component={gestureHandlerRootHOC(Home)} options={{ headerShown: false }} />

This solved the issue for me, for expo 49 and using a eas development build

@zuxcode
Copy link

zuxcode commented Apr 30, 2024

I Managed to resolve the problem by rebuilding my project

@CyxouD
Copy link

CyxouD commented May 14, 2024

As @zuxcode noted In my case for Expo project, I had to write npx expo prebuild first to reflect native code changes and only after that expo run:android

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

No branches or pull requests