Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

bash: jq:command not found

nazia_akhtar August 22, 2020

I am working on bitbucket pipelines using javascript/nodejs as the language.

I need 'jq' command in my script but it throws error of jq: command not found

Below is my bitbucket pipelines.yml file

 

jq.JPG

3 answers

1 accepted

1 vote
Answer accepted
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 31, 2020

Hi @nazia_akhtar ,

Thank you for your question!

You can add it with the next command before using jq:

apt-get install -y jq
1 vote
samarth adhikari November 3, 2021

jq error.PNG

Hi this is part of a script I am running to attach an image to a page. However, I am getting these errors:

line 10: jq: command not found

line 12: [: =: unary operator expected

Line 10 is ATTACHMENT_TITLE=$(curl -u $USER_NAME:$USER_PASSWORD \ -X POST \ -H "X-Atlassian-Token: nocheck" -F "file=@${ATTACHMENT_FILE_NAME}" -F "comment=File attached via REST API" \ ${CONFLUENCE_BASE_URL}/rest/api/content/${PAGE_ID}/child/attachment 2>/dev/null \ | jq -r '.results[].title')

Line 12 is if [ ${ATTACHMENT_TITLE} = ${ATTACHMENT_FILE_NAME} ]; then

Am not sure what is causing this error as I got this script from an atlassian page. Please let me know how I can fix and run this?

1 vote
Luca Bottoni August 12, 2021

 

image: node:10.15.3
pipelines:
default:
- step:
name: "prova default"
script:
- echo "Deploying version is $VERSIONRELEASE"
- ls
- mkdir build
- touch build/test.json
- ls build
- apt-get install -y jq
- declare -x VERSION=$(jq -r '.version' package.json)
- echo "package.json version is $VERSION"



+ apt-get install -y jq
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package jq

 

sorry, but does not work

koanplaned August 16, 2021

Hi Luca,

I had the same issue.

Before you can install jq, you have to make an "apt-get update"

Example:

- apt-get update 
- apt-get -y install jq
Like # people like this
Shailesh Gupta August 5, 2022
 apt-get update  this part is required

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events