node.jsgitbitbucketyarnpkg

Yarn package manager: install dependencies from private Bitbucket repository


I'm trying to migrate a project from NPM to Yarn.

Part of my node dependencies are private packages hosted on Bitbucket (not published on NPM registry) under the namespace of the company I'm working for.

With NPM I'm able to declare those kind of dependencies with different syntaxes in my package.json. Like this:

// package.json

"dependencies": {
  ...
  @myCompany/package-name": "bitbucket:bitbucket-username/repo-name.git",
  ...
}

But when I run yarn install I the following error:

ssh: Could not resolve hostname bitbucket: nodename nor servname provided, or not known
fatal: Could not read from remote repository.

I'm running yarn v0.23.3 on a MAC OSX.

Is there any further syntax or workaround to let yarn install private repository from bitbucket?

I've scraped into Yarn's github issues, but I wasn't able to find any hint to decide whether keep on trying or give up.

Thank in advance!


Solution

  • Try

    "@myCompany/package-name": "git+ssh://git@bitbucket.org/bitbucket-username/repo-name.git",
    

    At least, that's what I'm using and it works without any problems.