繁体   English   中英

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

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

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

目前看来,它已经坏了,但是一个临时性的解决方法是更改​​node-modules文件夹中的文件。

在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`);

谢谢里德的回答。 我听了你的指示,但稍作修改就可以了。 请注意第34行,因为网站编辑器漏掉了一些重要字符。 请参考下图以获得正确答案

工作守则

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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