react-native-gesture-handler module error - reactjs

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 ..)
Trying to run it on android.

I resolved this issue by adding this:
npm install react-native-gesture-handler
npx react-native link react-native-gesture-handler

Related

error opening web version react native in VS

I write in terminal npm start and after that I choose to run in web version. And i get this error
I tried to fix this problem like that "npm install react-native-web" But it didn't work
It looks like you're trying to use web support but don't have the required dependencies installed.
Please install react-native-web#~0.18.7, react-dom#18.0.0,
#expo/webpack-config#^0.17.0 by running:
npx expo install react-native-web#~0.18.7 react-dom#18.0.0
#expo/webpack-config#^0.17.0
If you're not using web, please ensure you remove the "web" string
from the platforms array in the project Expo config.
try this command: expo start --web
Installing both with legacy peer deps worked for me
npm i react-native-web --legacy-peer-deps
npm i react-dom --legacy-peer-deps
Install using this command:
Open Visual Studio Code terminal in the folder to install
npx expo install react-native-web#~0.18.7
npm install #expo/webpack-config#^0.17.0
npm install react-dom#18.0
Run this app with npm start

react native navigation TypeError: null is not an object (evaluating '_RNGestureHandlerModule.default.handleSetJSResponder')

I follow the steps of react-native docs.
npx react-native init SelfApp --template react-native-template-typescript
and then follow the steps of react-native-navigation.
yarn add #react-navigation/native
yarn add react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context #react-native-community/masked-view
then i add code
import 'react-native-gesture-handler';
to the first line of app.tsx.
then run yarn start, I got this error.
i tried a lot of times, but still in trouble, and here is my package.json
Hey according to this discussion on react-native-gesture-handler's GitHub, it's either a problem of linking, if you are on Android or a problem of some pods not being installed if you are on iOS.
It would be helpful to know which version of React Native you are using because if it's >= 60, it should support auto-linking, and if it is < 60, you should link the library manually.
In that last case:
Try these steps
For iOS:
$ cd ios
$ pod install
Another possible solution that has worked for other people, according to the discussion I mentioned above (see this specific response):
1 - Delete/Remove your node_modules directory
rm -rf node_modules
2 - Install your dependencies again
If you are using Yarn $ yarn install or if you are using npm npm install
3 Clean your Gradle
cd android
./gradlew clean
cd ..
react-native run-android

react-native-gesture-handler package error on new app

Hey I'm new to react native :) I get this error once I added react navigation to my app
I try to use navigate in react-native.. I added : npm install --save react-navigation
but it gives me an error like this :
\node_modules#react-navigation\native\src\Scrollables.js: Module
react-native-gesture-handler does not exist in the Haste module map
You need to install react-native-gesture-handler as well separately in the project dependency list and link it too with native as well. Please refer to this doc.
use the following command to install
if you are using yarn
yarn add react-native-gesture-handler
if you are using npm
npm i -s react-native-gesture-handler

Trying to build a create-react-app project with expo, throws error about react-native

I've created my react app using create-react-app, and was trying to use expo, but its throwing errors when I try and build it using expo build:android:
Error: Can't find react-native in package.json dependencies
Error: React Native is not installed. Please run `npm install` in your project directory.
Do I need to start over with a react-native project, or is there a way to continue on and get this project published?
I suggest you create your project using the expo docs :
npm install expo-cli --global
expo init my-new-project
cd my-new-project
expo start
Try this:
Remove node_modules folder.
run "yarn install".
run "expo start".
This looks like a similar issue on this github error
https://github.com/expo/expo-cli/issues/248

Failed to run jetifier React Native

I tried to run react-native run-android and I got this error.
info Running jetifier to migrate libraries to AndroidX. You can disable
it using "--no-jetifier" flag.
error Failed to run jetifier. Run CLI with --verbose flag for more details.
Error: spawnSync C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\jetifier\bin\jetify ENOENT
at Object.spawnSync (internal/child_process.js:1002:20)
at spawnSync (child_process.js:614:24)
at execFileSync (child_process.js:642:13)
at Object.runAndroid [as func] (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:101:41)
at Command.handleAction (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\#react-native-community\cli\build\cliEntry.js:160:21)
at Command.listener (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\commander\index.js:315:8)
at Command.emit (events.js:198:13)
at Command.parseArgs (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\commander\index.js:651:12)
at Command.parse (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\commander\index.js:474:21)
at setupAndRun (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\#react-native-community\cli\build\cliEntry.js:210:24)
Use this :
step 1: add these two lines in gradlew.properties Visit for complete guideline
android.useAndroidX=true
android.enableJetifier=true
step 2: use these commands
First of all remove node_modules folder and reinstall it using
npm install
or
yarn
and then
npm install --save-dev jetifier
npx jetify
npx react-native run-android
Call
npx jetify
every time when (your dependencies update or every time you install node_modules you have to jetify again)
When I was getting this error I noticed that I'm not in the main project folder I was inside the cd android folder. So I just cd .. it and it worked.
Use this:
react-native run-android --no-jetifier
If you run npx react-native run-android in android folder. That error will happen. You need to run-android in the root directory.
I'm using yarn so I had to use
yarn react-native run-android --variant=release
(Not npx)
Also to run in the simulator (not on a device) I had to install some extra stuff in Android Studio, see https://stackoverflow.com/a/64942777/3469524
react-native run-android --no-jetifier
and again start server
react-native start
Mostly it happened by cache, metro server closed or already generated package in android folder. check jetifier is enabled in gradle.proporties
android.useAndroidX = true
android.enableJetifier = true
First close your metro server terminal window and run $ yarn android // this is almost solve your issue otherwise follow the below steps
Then run
$ cd android && ./gradlew clean
Clean the cache and build folders - generated & intermediates
$ ./gradlew cleanBuildCache
Create the debug apk
$ ./gradlew AssembleDebug //output: Build successful
then check your apk output folder.
Run the react native package
$ yarn android || npx react-native run-android
Now it's working fine.
The issue is in React Native CLI v2.6.1
Use Below steps to resolve the issue:
If you use lock files (yarn.lock or package-lock.json) - find the #react-native-community/cli entry, remove it, run yarn install / npm install once again.
If you don't use lock files – remove node_modules and run yarn install / npm install again.
Run yarn list #react-native-community/cli or npm list #react-native-community/cli and verify you're on the latest version (v2.6.2).
Run react-native run-android
Just run the following command in the project's directory:
npm install --save-dev jetifier
Check current directory set to project root and then run npx react-native run-android
Just change from "C" directory to any other directory and then install/run starting from here
"npm install -g react-native-cli" .
Then create new project "react-native init AwesomeProject "
use Yarn to install dependencies fast.
It worked for me.
I use this react-native run-android --no-jetifier worked me

Resources