【问题标题】:Error when trying to start logKitty for React-Native Android Project尝试为 React-Native Android 项目启动 logKitty 时出错
【发布时间】:2019-12-24 17:36:49
【问题描述】:

我已在其他项目中运行此记录器而运行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)

【问题讨论】:

  • 有什么解决办法吗?
  • 在这里提交的错误报告:github.com/facebook/react-native/issues/26198
  • 现在我只是从路径似乎有效的项目文件夹中运行 log kitty。您不必在您正在运行的项目的文件夹中,log kitty 只需要正在运行,这样您就可以获得任何正在运行的项目的日志。我将查看错误报告@Reid。谢谢!

标签: android android-studio react-native


【解决方案1】:

它现在似乎坏了,但临时修复是更改你的 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`);

【讨论】:

  • 这是带有此修复程序的临时库,似乎可以正常工作:npmjs.com/package/@talaikis/logkitty
  • 抱歉延迟尝试。此修复程序有效。接受并赞成。
  • 有人维护 React-Native 吗?在这里发布了一个多月的解决方案,他们只是没有发布固定版本?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2021-04-13
  • 2016-12-29
  • 1970-01-01
  • 2018-04-19
  • 1970-01-01
  • 1970-01-01
  • 2022-11-07
相关资源
最近更新 更多