【问题标题】:How to add public bitbucket repo in package.json or bower.json如何在 package.json 或 bower.json 中添加公共 bitbucket 存储库
【发布时间】:2018-10-14 20:20:37
【问题描述】:

我有一个库作为公共存储库推送到 bitbucket。我希望它的链接在 package.json 依赖对象中使用。我尝试了各种 https 格式,但没有一种是有效的。

"library_name": "https://username@bitbucket.org/repo_name.git"

"library_name": bitbucket://bitbucket.com/username/repo_name.git

"library_name": "bitbucket@bitbucket.com:username/repo_name.git#master

或者我可以在 bower.json 中添加它?我不想像 npm install repo_url 那样直接使用它

我得到的错误类似于

ECMDERR Failed to execute "git ls-remote --tags --heads https://username@bitbucket.org/dv.keystone.git", exit code of #128 remote: Not Found fatal: unable to access 'https://username@bitbucket.org/reponame.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.

remote: Not Found
fatal: unable to access 'https://username@bitbucket.org/repo_name.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.

更新:

"lib_name": "https://username@bitbucket.org/team_name/repo_name.git"

它在 bower.json 中工作,但我需要在 package.json 中工作。如果我在 package.json 中使用它,它会给出这个错误

npm ERR! addLocal Could not install /tmp/npm-16628-b0121d64/git-cache-cbc9eb1e/7c4c6a5fb3e77723f3866c99fdf0825ba7cc0c5c
npm ERR! Linux 4.13.0-39-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v6.12.3
npm ERR! npm  v3.10.10
npm ERR! code EISDIR
npm ERR! errno -21
npm ERR! syscall read

npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.

【问题讨论】:

  • 澄清一下 - 你在哪里有 username@bitbucket.org,你是在使用 username 作为这个问题的占位符,还是你实际添加到 JSON 文件中的内容?
  • 这只是这个问题的占位符。

标签: npm bitbucket bower node-modules package.json


【解决方案1】:

我不知道如何在package.json 中添加 BitBucket 模块。我添加 github repo 的方式是,

"library-name": "git+https://github.com/user/library-name.git"

所以考虑只替换 github 部分应该是

"library-name": "git+https://bitbucket.org/user/library-name.git"

【讨论】:

  • Bitbucket 和 Github 的 URL 结构不同。不要认为你的例子会起作用。
  • 对不起,如果你能提供我想要添加的 repo,我可以提供帮助。我可以在我的电脑上尝试并更新你。
【解决方案2】:

为你做了一些谷歌搜索 - 我自己也不确定。

这可能对你有用:

git+https://bitbucket.org/{user}/{repo}.git

【讨论】:

  • 看起来和我的回答一样,虽然我之前错过了.org 部分。
  • @SajjadHossain 很好发现。一开始没注意。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-09
  • 2020-12-06
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多