将 jq 可执行文件添加到 env 变量后出现“bash: jq: command not found”(windows)

Cec*_*lia 2 bash json environment-variables git-bash jq

我想curl "https://jsonplaceholder.typicode.com/users" | jq 按照本教程视频使用命令(在 bash 中)在本地测试 json 文件:https : //www.youtube.com/watch?v=rrjIVEpRqPI

我按照每个步骤并在 env 变量路径中添加了可执行文件,但根本不起作用,我得到了结果:

$ curl "https://jsonplaceholder.typicode.com/users" | jq
bash: jq: command not found

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4670    0  4670    0     0   8584      0 --:--:-- --:--:-- --:--:--  8584
curl: (23) Failed writing body (795 != 1369)

Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?为什么我还是报错bash: jq: command not found??

Von*_*onC 6

您可以从 git bash运行jq.exe

你只需要在你的 git bash PATH 中安装它:

curl -L -o /usr/bin/jq.exe https://github.com/stedolan/jq/releases/latest/download/jq-win64.exe
Run Code Online (Sandbox Code Playgroud)

然后 jq 将与您的管道命令一起使用。

  • 您好,我刚刚通过使用“choco install jq”解决了这个问题,它的工作原理就像一个小工具,但感谢您的回答! (2认同)