3

We have a private nexus repository and publishing all the npm modules there. We have Module A and Module B, B is dependent on A. Here I am getting an issue with installing the latest SNAPSHOT version. For example: Module A has published versions like '1.0.0-SNAPSHOT', '1.0.1-SNAPSHOT', and '1.0.0' In Module B package.json, I added the dependency like

"Module A": "^1.0.0-SNAPSHOT"

As I mentioned "^" in the dependency, it should install the latest version (i.e, 1.0.1-SNAPSHOT), But I am not sure why it is installing '1.0.0' instead '1.0.1-SNAPSHOT.

Your help would be greatly appreciated. Thanks in Advance.

Ram's
  • 111
  • 1
  • 1
  • 12

1 Answers1

2

Avoid releasing and using snapshot dependencies. When you publish a release, it should not contain -SNAPSHOT. Referring to a proper release is mandatory in order to be sure you are testing/executing the right code without side effects due to regression problems. You need to know in every moment which version you are using, that is very important, so relying on latest versions of your modules might not be the best solution, it doesn't worth it either if you are precise with major, minor and patch bits in order to avoid breaking changes or unexpected behaviors.

If you really need to develop them together you can use npm link command instead.

Yak O'Poe
  • 760
  • 4
  • 14