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

Can I update my NodeJS repo package.json file with BITBUCKET_BUILD_NUMBER

John Ruggentaler
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 17, 2024

I have a NodeJS project and I want to capture the BITBUCKET_BUILD_NUMBER in package.json. Can this be done in my Bitbucket pipeline build? Below is what I added to my bitbucket-pipelines.yml. 

# update the package.json BUILD_NUMBER propertie
- npm pkg set BUILD_NUMBER="${BITBUCKET_BUILD_NUMBER}"
- npm pkg set description="Build Number ${BUILD_NUMBER} `date '+%Y-%m-%d %H:%M:%S'`"
- git commit package.json -m "Automated build commit on `date '+%Y-%m-%d %H:%M:%S'`"
- git push

 I am getting errors on git "bash: git: command not found".

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 20, 2024

Hi John!

That error message indicates that git is not installed as part of the build image that you are using, you will either need to install git first before executing git commands or use another image that has git included.

We have an article for troubleshooting this below:

I hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events