Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is jq installed and available on PATH?

I am trying to read a yaml file in gitlab CI. I installed jq==1.0.2 and yq==2.10.1 using pip in my CI job and I use python:3.7 image. When I tried to read the yaml file, it has the error

yq: Error starting jq: FileNotFoundError: [Errno 2] No such file or directory: 'jq': 'jq'. Is jq installed and available on PATH?

My yaml file is not call jq and I do have this yaml file in my commit. I am able to do which yq, when I do which jq, the CI job failed. Anyone has any idea?

like image 581
Serena Xu Avatar asked Aug 05 '20 13:08

Serena Xu


2 Answers

Your jq installation is not quite correct. Your version information jq==1.0.2 indicates that you have installed the python package jq - https://pypi.org/project/jq/ which is not the same as the executable binary jq that gets installed. You need the executable to be installed, before invoking the yq tool.

Since yq looks in PATH for availability of the jq binary, but doesn't find it, you get the runtime error indicating the absence. The fix will be setup your CI to download the jq binary from one of the steps mentioned in https://stedolan.github.io/jq/download/

like image 149
Inian Avatar answered Oct 23 '22 22:10

Inian


Run sudo apt-get install jq not pip3 install jq.

like image 2
xinthose Avatar answered Oct 23 '22 23:10

xinthose