NPM 指定没有版本号的包依赖

NPM specify package dependency without version number

我有两个存储库 X 和 Y。Y 在其 package.json 中引用 X 以使用某些模块。 X 和 Y 有 master 分支,都部署到公共 npm-registery(我们称之为 2.0.0 版)。因此,repo Y 在其 package.json 中引用了 X 2.0.0。一切都很好。

现在,问题--

我在两个存储库中都创建了一个新分支(我们称它们为 bX 和 bY)。这 2 个分支尚未准备好合并到其对应分支的 master。因此 我无法发布仅更改了 bX 的 X 的新版本。或者我可以吗?

但我想将我在 bX 中所做的更改用于 bY。

当我四处搜索时,我发现我可以像这样在 Y 的 package.json 中给出回购 X 的 url -- https://github.com/url-to-repo/X.git#bX 当我使用 npm 构建时,它在我的本地系统中运行良好。但是当我将它与 jenkins build 一起用于测试环境时,它失败并出现以下错误 --

The requested URL returned error: 403 while accessing https://github.com/url-to-repo/X.git/info/refs

这个问题似乎与以下内容有关 --

Please upgrade your git client. GitHub.com no longer supports git over dumb-http: https://github.com/blog/809-git-dumb-http-transport-to-be-turned-off-in-90-days

我登录了 Jenkins 服务器,git 版本是 1.7.2.5(在 GitHub 中撤销了转储 http 支持,但这不会影响你,除非你是 运行 v1.6.6 之前的 git 版本并使用 http 远程获取 URL -- 来自 github 文档)

所以我不明白这里出了什么问题。有人遇到过这个问题吗?

一个解决方案可能是使用 SSH url 而不是 https。

所以,而不是

https://github.com/user/repo.git

你将拥有

git@github.com:user/repo.git

如果您没有在计算机上设置 SSH 密钥,here is how to do it