Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

reactjs - 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:UsersJayKDesktopReactAwesomeProject
ode_modulesjetifierinjetify 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:UsersJayKDesktopReactAwesomeProject
ode_modules@react-native-communitycli-platform-androiduildcommands
unAndroidindex.js:101:41)
    at Command.handleAction (C:UsersJayKDesktopReactAwesomeProject
[email protected]:160:21)
    at Command.listener (C:UsersJayKDesktopReactAwesomeProject
ode_modulescommanderindex.js:315:8)
    at Command.emit (events.js:198:13)
    at Command.parseArgs (C:UsersJayKDesktopReactAwesomeProject
ode_modulescommanderindex.js:651:12)
    at Command.parse (C:UsersJayKDesktopReactAwesomeProject
ode_modulescommanderindex.js:474:21)
    at setupAndRun (C:UsersJayKDesktopReactAwesomeProject
[email protected]:210:24)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...