Npm 如何在package.json或bower.json中添加公共bitbucket repo

Npm 如何在package.json或bower.json中添加公共bitbucket repo,npm,bitbucket,bower,node-modules,package.json,Npm,Bitbucket,Bower,Node Modules,Package.json,我把一个图书馆推到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:us

我把一个图书馆推到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安装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.

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

“库名称”:“git”+https://github.com/user/library-name.git“

因此,要想更换github部件,它应该是


“库名称”:“git”+https://bitbucket.org/user/library-name.git“

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

“库名称”:“git”+https://github.com/user/library-name.git“

因此,要想更换github部件,它应该是


“库名称”:“git”+https://bitbucket.org/user/library-name.git“

帮你做了一些谷歌搜索——因为我自己也不确定

这可能适用于您:


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

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

这可能适用于您:


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

只是想澄清一下-您的
username@bitbucket.org
您是否使用
用户名
作为此问题的占位符,或者这就是您实际添加到JSON文件中的内容吗?这只是这个问题的占位符。只是为了澄清一下-您的
username@bitbucket.org
您是否使用
用户名
作为此问题的占位符,或者这就是您实际添加到JSON文件中的内容吗?这只是这个问题的占位符。Bitbucket和Github有不同的URL结构。我认为你的例子行不通。啊,很抱歉,如果你能提供你想要添加的回购协议,我可以帮你。我可以在我的电脑上试用并更新你。Bitbucket和Github有不同的URL结构。我认为你的例子行不通。啊,很抱歉,如果你能提供你想要添加的回购协议,我可以帮你。我可以在我的电脑上试用并向你更新。看起来和我的答案一样,尽管我之前错过了
.org
部分。@SajjadHossain很好地发现了这一点。起初没有注意到。看起来和我的答案一样,尽管我之前错过了
.org
部分。@SajjadHossain很好地找到了。起初没有注意到。