react-native - react-native profile-hermes 中的 grep 错误

当使用 react native cli 将 Hermes 跟踪配置文件转换为 chrome 跟踪配置文件并使用命令将其拉到本地计算机时

npx react-native profile-hermes [destinationDir]

我收到这样的错误。我正在使用 Windows 10 和 react native 版本 0.66

'grep' 不是内部或外部命令,也不是可运行的程序或批处理文件。 error 错误:命令失败:adb shell run-as com.madhusona ls cache/ -tp | grep -v /$ | grep -E '.cpuprofile' |头-1

我在登录 adb shell 后发出命令,grep 正在运行

D:\madhusona> adb shell
generic_x86:/ $ run-as com.madhusona
generic_x86:/data/user/0/com.madhusona $ ls cache/ -tp | grep -v /$ | grep -E '.cpuprofile' | head -1
sampling-profiler-trace767276177515590089.cpuprofile
generic_x86:/data/user/0/com.madhusona $

回答1

我可能已经找到了一个相关的问题,可以部分(或完全,我不确定)解释您的问题。

我知道您找到了绕过它的方法,但它仍然可能对您或其他人有帮助;)

https://stackoverflow.com/a/40983617/8687881

编辑:

我用 git bash 弄明白了。它与许多 POSIX(UNIX/Linux/等)实用程序捆绑在一起,例如 grep。因为 grep 不是 Windows 函数,所以您无法轻松替换 Windows 的 grep(然后是“head”函数)。

相似文章

随机推荐

最新文章