I'm trying to install a private package recently moved from github to bitbucket.
npm install [email protected]:owner/repo.git
ends up with
npm http GET https://registry.npmjs.org/git
(note package in the url) with this error:
npm ERR! notarget No compatible version found: git@'bitbucket.org:flyvictor/fortune-secruity.git'
(note a '
just after @
)
I tried to escape @, wrap repo name in quotes, but always get same result.
For github we use urls formatted as git://github.com/owner/repo#v.v.v
and this works fine! But if I use same syntax for bitbucket npm just hangs doing nothing.
Any idea?
p.s. keys, access right and so one are correct. I can contribute to these repos, clone them with git, but not to npm install. Github packages that get installed well are also private.
The Npm command not found error can appear when you install or upgrade npm. On Windows, the cause of this error could be that a PATH or system variable is not correctly set. The error can also occur if you do not have npm or Node. js installed, have an outdated version, or have permission issues.
The -f or --force argument will force npm to fetch remote resources even if a local copy exists on disk. The -g or --global argument will cause npm to install the package globally rather than locally.
npm install git+ssh://[email protected]/{user}/{repository}.git
npm install bitbucket:<bitbucketname>/<bitbucketrepo>
Declaimer: As Eric Uldall said: this method is easy but it lacks security. You have now committed a password in plain text to your repository. That's how is working out lately for me, but not recommended.
Straight from the npm Documentation for the install
command:
$ npm install bitbucket:<bitbucketname>/<bitbucketrepo>[#<commit-ish>]
Example:
$ npm install bitbucket:mybitbucketuser/myproject
The Yarn documentation for add
as of today Feb 28, 2019 doesn't have support for git repositories.
The above example didn't work for me with private repositories, because you will need to generate a token to use it. How is that?
Login to your Bitbucket account and under user settings add an app password:
Then you can add the dependency to your package.json
as:
"dependencies": {
"module": "git+https://<username>:<app-password>@bitbucket.org/<owner>/<repo>.git"
}
or on your terminal type:
npm install git+https://<username>:<app-password>@bitbucket.org/<repo-owner>/<repo>.git
Don't forget to replace:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With