Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Private self hosted npm repository package on bitbucket using pipelines

I'm trying to use a self hosted (in bitbucket) npm package. I was able to use it locally without any issues, but when running the bitbucket pipeline I get an error. It fails on the npm install step.

This is what I have on the repo using the private npm package:

"dependencies": {
"shared-lib": "ssh://{org-name}/shared-lib.git"

Both repositories are under the same organization (private) in bitbucket.

On the library that is consuming the self hosted private npm package I created a key by going to: Settings > Pipelines > SSH Keys (self generated key on bitbucket)

On the shared-lib, I have added this SSH key by going to Settings > SSH Keys > Add key (self generated).

Also added as known address.

The bitbucket-pipelines.yml at this moment does not have any special configuration, i'm only running npm install (where it fails) and npm run test.

This is the configuration I have, but still fails when running the pipeline.

This is the error when running the pipeline:

npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://{org-name}/shared-lib.git
npm ERR! enoent 
npm ERR! enoent 
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent```

1 answer

0 votes

Hi Luis and welcome to the community.

The most likely reason for this error is Git not being installed in the Docker image you are using in Pipelines. You can check if that's the case by adding the following command in your yml file (before the npm install command):

git --version

If Git is not installed, then:

- You can install Git during the build, before the npm install command
- Alternatively, you can use a different Docker image that already has Git pre-installed
- If you are using a custom Docker image that you own and maintain, you can add Git to this image

Please feel free to let me know how it goes and if you have any questions.

Kind regards,

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

188 views 2 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you