我正在尝试运行我的React本机项目,但出现以下错误:
error Failed to run jetifier. Run CLI with --verbose flag for more details.
Error: spawnSync C:\Users\viral\StudioProjects\ReactNative\Demo\CoTask\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\viral\StudioProjects\ReactNative\Demo\CoTask\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:101:41)
at Command.handleAction (C:\Users\viral\StudioProjects\ReactNative\Demo\CoTask\node_modules\react-native\node_modules\@react-native-community\cli\build\cliEntry.js:160:21)
at Command.listener (C:\Users\viral\StudioProjects\ReactNative\Demo\CoTask\node_modules\commander\index.js:315:8)
at Command.emit (events.js:198:13)
at Command.parseArgs (C:\Users\viral\StudioProjects\ReactNative\Demo\CoTask\node_modules\commander\index.js:651:12)
at Command.parse (C:\Users\viral\StudioProjects\ReactNative\Demo\CoTask\node_modules\commander\index.js:474:21)
at setupAndRun (C:\Users\viral\StudioProjects\ReactNative\Demo\CoTask\node_modules\react-native\node_modules\@react-native-community\cli\build\cliEntry.js:210:24)
我已经在gradle.properties中添加了以下代码,但是没有用。
android.useAndroidX=true
android.enableJetifier=true
答案 0 :(得分:1)
临时运行
react-native run-android --no-jetifier