5

TL;DR:

My project has dependency of "dep": "snapshot" where 'snapshot' is a tag. Running npm install does not fetch new version of "dep".

Full story:

So just recently I started with a JS project, and... to make a long story short i setup my own private repo via a locally installed Nexus. Let's call my project myProj1.

I added the Nexus registry in my .npmrc like so:

registry=http://nexus:8081/nexus/content/groups/npm-all/

All is fine, I try and release snapshot versions before i release any production ready code. This includes running npm-snapshot X where X is my snapshot number. (It's basically a plugin that changes the package.json version tag to something like 1.0.0-SNAPSHOT.24 (if X = 24)

I then run

npm publish --tag=snapshot --registry=http://nexus:8081/nexus/content/npm-internal

and it pushes the code to my Nexus, and all seems fine. The tag "snapshot" in my nexus registry is updated to the recently published version. (1.0.0-SNAPSHOT.24)

I then have another project which has a dependency on the above module in it's package.json specified as such:

"dependencies": {
    "myProj1": "snapshot"
}

So I run npm install in the project root, and lo' and behold, the dependency get's downloaded perfectly, everything is awesome!

Now here comes my issue:

I then decide to update some stuff in myProj1, making me release another snapshot version with the same command above. (causing the newly published artifact to be versioned 1.0.0-SNAPSHOT.25) My Nexus is awesome and publishes the new dependency like it should, also updating the dist-tag "snapshot" to the newly built version.

HOWEVER, when i run npm install from my other project, believing I should be getting a newer version of myProj1, nothing happens. It doesn't fetch the newer snapshot version. Why's that?

Have I misunderstood having a dependency on a dist-tag? Can I do this some other way?

Regards

Robin Jonsson
  • 2,761
  • 3
  • 22
  • 42
  • Unless things have changed recently, it could be that npm still doesn't handle snapshot versions: https://www.reddit.com/r/javascript/comments/2iobbs/how_do_you_handle_private_snapshot_builds_with_npm/ – r0hitsharma Apr 12 '16 at 14:50
  • I know it doesn't. That's why I'm abusing the "pre-release" numbers. However i tag every "pre-release" but my project doesn't want to download the new "pre-releases" – Robin Jonsson Apr 12 '16 at 18:09
  • @r0hitsharma I thought by adding the dependency by pointing to a "tag" that it'd do automatic updates when a new version on the same "tag" got released. But I guess not? – Robin Jonsson Apr 12 '16 at 18:16
  • exactly, there's no new release in npm's eyes. – r0hitsharma Apr 13 '16 at 11:31
  • @r0hitsharma But there is! my npm registry updates the tag to point to a newer version. That must mean theres a new release. – Robin Jonsson Apr 13 '16 at 13:36
  • Possible duplicate of [npm outdated does not respect caret notation of package.json](http://stackoverflow.com/questions/28636506/npm-outdated-does-not-respect-caret-notation-of-package-json) – Paul Sweatte Feb 01 '17 at 16:06
  • Meeting the exact situation as you. Did you find a solution? – Jack Lu May 13 '19 at 03:47
  • Yep, same problem, after first pull, npm doesn't pull any newer versions, even when going from 1.0.2 to 1.0.3, etc. – stricq Oct 25 '19 at 18:02

0 Answers0