我尝试运行 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)
原文由 NduJay 发布,翻译遵循 CC BY-SA 4.0 许可协议
用这个 :
第 1 步:在 gradlew.properties 中添加这两行 访问完整指南
第 2 步:使用这些命令
首先删除 node_modules 文件夹并使用重新安装它
或者
接着
称呼
每次(您的依赖项更新或每次安装 node_modules 时都必须再次jetify)