Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)

like image 822
NduJay Avatar asked Jul 16 '19 01:07

NduJay


People also ask

What is Jetifier unity?

Jetifier helps migrate third-party dependencies to use AndroidX. Jetifier will change the byte code of those dependencies to make them compatible with projects using AndroidX. Having Jetifier enabled on your project ( android.


3 Answers

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)

like image 173
Arslan Bajwa Avatar answered Sep 23 '22 02:09

Arslan Bajwa


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.

like image 45
Chaudhry Talha Avatar answered Sep 23 '22 02:09

Chaudhry Talha


Use this:

react-native run-android --no-jetifier

like image 27
james murphy Avatar answered Sep 20 '22 02:09

james murphy