Ivin
Ivin

Reputation: 4815

NPM specify package dependency without version number

I have two repos X and Y. Y references X in its package.json for using some modules. X and Y have master branches and both are deployed to common npm-registery(lets call it version 2.0.0). So repo Y references X 2.0.0 in its package.json. All good till here.

Now, the problem --

I have created a new branch in both repos(lets call them bX and bY). These 2 branches are not ready to be merged to the master of their corresponding branches. Hence I cannot publish a new version of X with bX changes only. Or can I?

But I want to use the changes I have made in bX to be used in bY.

When I googled around, I found that I can give the url of repo X in Y's package.json like this -- https://github.com/url-to-repo/X.git#bX and it works fine in my local system when I built with npm. But when I used it with jenkins build for testing environment, it fails with the following error --

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

And that issue seems to be related to the following --

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

I logged into Jenkins server and the git version there is 1.7.2.5 (In GitHub the dump http support is revoked but this won't effect you unless you're running a git version prior to v1.6.6 and fetch using a http remote URL -- from github docs)

So I dont understand what is going wrong here. Has anyone faced this issue before?

Upvotes: 1

Views: 1051

Answers (1)

Ionică Bizău
Ionică Bizău

Reputation: 113445

A solution could be to use SSH urls instead of https ones.

So, instead having

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

You will have

[email protected]:user/repo.git

If you didn't set up your SSH keys on your machine, here is how to do it.

Upvotes: 1

Related Questions