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

How can I install an npm package from my bitbucket repository?

Robert Heath Mar 18, 2018

How can I install an npm package from my bitbucket repository?

3 answers

3 votes
Ana Retamal Ortiz Atlassian Team Mar 19, 2018

Hi Robert!

You can do that by typing 

npm install git+ssh://{user}/{repository}.git

I also found a blog that might be useful for you: npm install modules from Bitbucket private repositories.

Hope that helps!


Yamil Padron Nov 19, 2018

Is not working for me... 

1 vote
Adam Gerthel I'm New Here Jan 21, 2019 • edited Apr 15, 2019

It works for me, but when running `npm install` or `npm update` any package that has been installed using the suggested way gets removed. It's annoying because it's really easy to miss since you have to scan package-lock.json for the change.

EDIT: For clarity, the repos that this is happening with are private (but I can initially install etc, so I do have access via git)

John Ericson I'm New Here Feb 18, 2019

Adam, try adding -S (for dependency) or -D (for devDependency).

npm install -S git+ssh://{user}/{repository}.git

That will save the dependency to your package.json so next time you install it should not get removed.

Adam Gerthel I'm New Here Feb 19, 2019

Right, but that's not what's happening. Like I said, the package gets removed from the lockfile when running `npm install` (and it would never have been in the lockfile if I hadn't used -S or -D). I've never seen this happen with any other package, so I'm guessing that it has to do with Bitbucket.

0 votes
lobna arouini I'm New Here Mar 17, 2019
  1. i Add "mymodule": "git+" to dependencies within my project 
  2.  run npm install, they prompt a dialog to enter username and pass
  3. Voila! works


I suppose you may need to create ssh key and add it to your bitbucket settings in case your module is private 

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

1,911 views 1 19
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