-
Notifications
You must be signed in to change notification settings - Fork 3k
Updating git dependency urls does not work #1727
Comments
In general, @mikeal asked me about this last night. I think if you and he are getting confused by it, it's the wrong api. Wanna discuss on the npm-@googlegroups.com mailing list? |
I've created a discussion on the mailing list, would love to get your input: https://groups.google.com/d/topic/npm-/KnSd2gpA6fw/discussion |
+1 I've been |
@isaacs: did you have a chance to look at this yet / read the post in the ML? |
I saw the mailing list post, but haven't gotten to it yet. Been super busy trying to get 1.1 finished (with the built-in tar stuff.) |
To add my two cents: This becomes something of an issue when attempting to deploy to a PaaS, such as Heroku. And by issue, I mean the only way around it seems to be completely destroying the application and re-deploying it from scratch. |
@isaacs np, I understand. @jperras Good point. I'm rather suprised that heroku doesn't wipe the install on deployment so. It seems like that's what they are advocating: http://www.12factor.net/ (Great articles btw.) |
@jperras are you able to deploy a git dependency on heroku? I am getting: http://stackoverflow.com/questions/8243527/use-git-dependencies-in-with-npm-and-node-on-heroku/8299062#8299062 |
@juggy Yes, but I have it pointed towards a tarball, e.g. "dependencies": {
"blah": "https://github.com/jperras/repository_name/tarball/v1.2.0",
...
}, |
I'm not sure this is the same issue, but I've seen that git updates treats the git dependencies as npm registry modules, here's an example:
But it worked with npm install:
|
What is the current workaround for this? I tried pointing the dependency at a url like:
but it doesn't seem to update to latest when I run |
@jesseditson Just install it again. That's all update does, but there's no way for it to know that it's out of date. But, the original need for this should be fixed. |
Well there is, if it detects a change in the url(changing the tag), it should be able to detect that and re-install it. |
Right, so if the package.json's _from attribute doesn't match the url dep, then it should update it, or treat it as an invalid dep. That's why this issue is still open :) |
This is a major gotcha for me as well, and I'm sure many others. We depend on git and npm to update our production code, now there is no point to running npm update ever. |
Can't |
@ypocat +1. Patch welcome. |
Yeah, running into this as well... deploying Node with Capistrano, and pulled a trick to share However, I'm noticing dependencies are not properly updating. So back to the slower deploys until theres a good method for doing this. |
+1 to fix this. I currently work around by doing: $ npm update
$ npm install mygitdep where {
"dependencies": {
"mygitdep": "git+ssh://git@our.gitlab.server/mygitdep.git"
},
} |
As far as I understand, it updates if it's not the same version. So it seems this is filtered out earlier. Can't see where though. Gut-wise, I think the game is over there. |
+1 I've been doing |
+1 |
FWIW, |
+1 |
I'll have some time this weekend for npm bugs (probably just this one heh). If someone wants to do it before then, feel free. |
pro tip: |
This addresses issue npm#1727. The change ensures that git dependencies will always update by checking for _resolved.
The question is: why do you want them to share the same instance of D? This sounds an awful lot like a global variable with the usual problems. |
D has a pool of connections to the DB. Rather than have A B and C have On Thu, Jun 5, 2014 at 2:01 PM, fresheneesz notifications@github.com
|
I would recommend creating a way to pass a connection pool to D. That way you can share the same connection pool, not only with D, but with any module that needs it. |
I already do that, but I will have to do it at multiple places now (in A, B On Fri, Jun 6, 2014 at 1:39 AM, fresheneesz notifications@github.com
|
True, but doing it this way is almost definitely the best way to ensure that other people can use your modules effectively and efficiently. In the cases where modules are using different versions of D, or where a module is using A, B, or C but doesn't require D, it will allow them to still have a single connection pool. Relying on the require cache to handle this for you doesn't allow that. Anyways, I'm sure you'll figure out how to best handle this for your modules. |
the temp fix from @asgrim works for me. |
Any plans to finally fix this? |
Why is this closed, it still does not work as expected. |
Edit: Correction, changing the major version seems to have worked. So I think the current behavior is |
Same boat here. Using a tarball URL to install a package that gets updated frequently, but NPM does not take the newest version, even thought the new version is already in the local cache ( I'm currently using |
same here.. can't get npm install to install anything newer than a 13 day old commit.. we've had 20 commits since then.. we have to specify the commit hash each time we change the dependency for this to work properly? |
I have the same issue... And in my case, it's quite confusing: I have a github open source public dep and a bitbucket private dep, both managed by me and with the package.json set up exactly the same way. I I guess my question is: Why is there a difference between github and bitbucket (both git repos, forgot to say... no tarball or mercurial etc.)? Edit: Edit2: |
I think I have the same issue. I have a shared library dependency which project X uses.
I have to manually write into the command line:
So right now, my build tools are kind of dead, however, this seems like an old problem and I am wondering if I am just approaching it wrong. |
In #3328 (and also somewhere above in this massive thread) there is a suggestion to use branch references such as package.json
...
"dependencies": {
"my-project": "bitbucket:my-username/my-project#master"
}
... In my usage with v3.10.8, There doesn’t appear to be any built in support for versioning of git based dependencies, however a manual strategy such as maintaining and referencing semver style branches such as If you follow the thread further in #3328 there is the suggestion that support for |
This is slightly off topic (please chime in if you think I should create a separate issue): It would be nice to specify the semversion you want from a github url. It would need a new bit of syntax. I'm thinking something like:
The idea is that npm would fetch only package.json from the repo, check and then automatically download and install whatever it finds there if the version number has changed. This inherits the useful features of the existing versioning mechanism, and some:
I haven't spelunked NPM, but isn't the change as simple as:
? |
@aneilbaboo you can use the following:
After slash there could be a tag, branch, or even SHA of the commit. |
If you installed a node package from git, you can force an update by using it's package.json name, without the full url. For instance if you have
You should be able to do |
The problem for me personally (is still) that Once you install from say bitbucket, that appears to be that. There is no way to It really annoys me, again like I stated, it is for a reason by far more clever folk than me, but since I can't find the reason and can't find the solution, all that remains is rage. 😄 |
Same problem here. 囧 |
At the end I ended up writing postinstall script that is then executed automatically.
|
Currently npm does not notice when the version reference of a previously installed package is upgrade to a git url.
So in order to get the right version one has to
rm -rf node_modules/<package>
first before runningnpm install
again.Example: Consider the following package which had some changes in master after version 0.0.2 was released. Among them the Readme was modified:
Let me know if I can provide further details.
--fg
The text was updated successfully, but these errors were encountered: