简体   繁体   中英

Error when trying to start logKitty for React-Native Android Project

I have run this logger in other projects without issue running react-native log-android why is the logger failing in this project folder. These are mostly out of box react-native init NewProjects with very few changes. So im surprised this one project I can't run the logger in. I like the cmd logger better. Its faster than running the one in chrome.

λ react-native log-android
info Starting logkitty
The filename, directory name, or volume label syntax is incorrect.
error Command failed: 'C:\Users\{UserPIN}\AppData\Local\Android\Sdk/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}\AppData\Local\Android\Sdk/platform-tools/adb' logcat -c
The filename, directory name, or volume label syntax is incorrect.

    at spawnLogcatProcess (c:\ws\mobile2\ReactRegLoc\node_modules\logkitty\build\android\adb.js:36:11)
    at runAndroidLoggingProcess (c:\ws\mobile2\ReactRegLoc\node_modules\logkitty\build\android\adb.js:21:10)
    at logkitty (c:\ws\mobile2\ReactRegLoc\node_modules\logkitty\build\api.js:137:85)    at Object.logAndroid [as func] (c:\ws\mobile2\ReactRegLoc\node_modules\@react-native-community\cli-platform-android\build\commands\logAndroid\index.js:37:44)
    at Command.handleAction (c:\ws\mobile2\ReactRegLoc\node_modules\react-native\node_modules\@react-native-community\cli\build\cliEntry.js:160:21)
    at Command.listener (c:\ws\mobile2\ReactRegLoc\node_modules\commander\index.js:315:8)
    at Command.emit (events.js:189:13)
    at Command.parseArgs (c:\ws\mobile2\ReactRegLoc\node_modules\commander\index.js:651:12)
    at Command.parse (c:\ws\mobile2\ReactRegLoc\node_modules\commander\index.js:474:21)
    at setupAndRun (c:\ws\mobile2\ReactRegLoc\node_modules\react-native\node_modules\@react-native-community\cli\build\cliEntry.js:210:24)

It seems broken for right now, but a temporary fix is to change the file in your node-modules folder.

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

Change line 29 to:

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

And change line 34 to:

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

Thank you Reid for your answer. I did your instruction but a little edit works for me. Please be careful with the line 34, some of important characters are missed because the website editor. Please refer to the below image for accurate answer

Working Code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM