You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
How can I install an npm package from my bitbucket repository?
Hi Robert!
You can do that by typing
npm install git+ssh://git@bitbucket.org/{user}/{repository}.git
I also found a blog that might be useful for you: npm install modules from Bitbucket private repositories.
Hope that helps!
Ana
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If my ssh has a passphrase, npm is stuck without any prompt to enter passphrase or throwing an error. If I try to use https, npm throws "To make a call, you need to use an app password." If I create an app password I cannot do it for each project and that makes all my projects visible with the password. Do you have any other alternatives in this scenario?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I solved the above issue by using ssh with a passphrase. When npm install is stuck without any prompt, I just enter the passphrase for my ssh file and it works as expected. If entering your passphrase first time didn't work, try entering it multiple times (max 3 times).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
what other form of authentication apart from SSH is allowed to access the package?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The "proper" way to do this (if not using a private package repository) is to use https authentication instead of ssh. Create a deploy key for the repository you wish to use as a dependency and put that into your "package.json" like so
git+https://<deploy_token_user>:<deploy_user_password>@bitbucket.com/<user>/<repo>[#<version>]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I suppose you may need to create ssh key and add it to your bitbucket settings in case your module is private
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Adam, try adding -S (for dependency) or -D (for devDependency).
npm install -S git+ssh://git@bitbucket.org/{user}/{repository}.git
That will save the dependency to your package.json so next time you install it should not get removed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.