尝试为 React-Native Android Project 启动 logKitty 时出错



我已经在其他项目中运行了此记录器,运行没有问题react-native log-android为什么记录器在此项目文件夹中失败。 这些大多是开箱即用的react-native init NewProjects几乎没有变化。 所以我对这个项目感到惊讶,我无法运行记录器。 我更喜欢cmd记录器。 它比在铬中运行一个更快。

λ react-native log-android
info Starting logkitty
The filename, directory name, or volume label syntax is incorrect.
error Command failed: 'C:Users{UserPIN}AppDataLocalAndroidSdk/platform-tools/adb' logcat -c
The filename, directory name, or volume label syntax is incorrect.
. Run CLI with --verbose flag for more details.
Error: Command failed: 'C:Users{UserPIN}AppDataLocalAndroidSdk/platform-tools/adb' logcat -c
The filename, directory name, or volume label syntax is incorrect.
at spawnLogcatProcess (c:wsmobile2ReactRegLocnode_moduleslogkittybuildandroidadb.js:36:11)
at runAndroidLoggingProcess (c:wsmobile2ReactRegLocnode_moduleslogkittybuildandroidadb.js:21:10)
at logkitty (c:wsmobile2ReactRegLocnode_moduleslogkittybuildapi.js:137:85)    at Object.logAndroid [as func] (c:wsmobile2ReactRegLocnode_modules@react-native-communitycli-platform-androidbuildcommandslogAndroidindex.js:37:44)
at Command.handleAction (c:wsmobile2ReactRegLocnode_modulesreact-nativenode_modules@react-native-communityclibuildcliEntry.js:160:21)
at Command.listener (c:wsmobile2ReactRegLocnode_modulescommanderindex.js:315:8)
at Command.emit (events.js:189:13)
at Command.parseArgs (c:wsmobile2ReactRegLocnode_modulescommanderindex.js:651:12)
at Command.parse (c:wsmobile2ReactRegLocnode_modulescommanderindex.js:474:21)
at setupAndRun (c:wsmobile2ReactRegLocnode_modulesreact-nativenode_modules@react-native-communityclibuildcliEntry.js:210:24)

现在它似乎坏了,但临时解决方法是更改节点模块文件夹中的文件。

In node_modules/logkitty/build/android/adb.js

将第 29 行更改为:

return process.env.ANDROID_HOME ? `${process.env.ANDROID_HOME}\platform-tools\adb` : 'adb';

并将第 34 行更改为:

(0, _child_process.execSync)(`${adbPath} logcat -c`);

最新更新