无法运行jetifier React Native
Ndu*_*Jay 5 reactjs react-native-android
我尝试运行react-native run-android,但出现此错误。
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)
小智 32
用这个 :
第一步:在 gradlew.properties 中添加这两行 访问完整指南
android.useAndroidX=true
android.enableJetifier=true
第 2 步:使用这些命令
首先删除 node_modules 文件夹并使用
npm install
或者
yarn
进而
npm install --save-dev jetifier
npx jetify
npx react-native run-android
称呼
npx jetify
每次(您的依赖项更新或每次安装 node_modules 时,您都必须再次 jetify)
Cha*_*lha 19
当我收到此错误时,我注意到我不在主项目文件夹中,我在cd android
文件夹中。所以我就cd ..
这么做了,它奏效了。
jam*_*phy 10
用这个:
react-native run-android --no-jetifier
小智 5
我正在使用纱线,所以我不得不使用
yarn react-native run-android --variant=release
(不是npx
)
另外要在模拟器中运行(而不是在设备上),我必须在 Android Studio 中安装一些额外的东西,请参阅/sf/answers/4545994421/
小智 5
如果你npx react-native run-android
在 android 文件夹中运行。会发生那个错误。你需要在根目录下运行-android。
标签:node,js,React,jetifier,android,Native,native From: https://www.cnblogs.com/sexintercourse/p/16974185.html