问题
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
来源:https://stackoverflow.com/questions/36575821/npm-install-to-get-dependency-with-tag-version