0

When trying to install a package it doesn't install the latest version of dependency which version defined as a tag in package.json:

"dependencies": { "mcs-common-test": "SNAPSHOT" }

Steps to Reproduce We have package "molina_ms" with dependency "mcs-common-test"

  1. Publish "mcs-common-test" to private registry (Nexus 2) as version 1.0.0-SNAPSHOT.1 with tag "SNAPSHOT"
$ npm publish --tag SNAPSHOT 
npm notice 
npm notice  mcs-common-test@1.0.0-SNAPSHOT.1 
npm notice === Tarball Contents === 
npm notice 32.3kB index.js 
npm notice 620B package.json 
npm notice 179B readme.md 
npm notice === Tarball Details === 
npm notice name: mcs-common-test 
npm notice version: 1.0.0-SNAPSHOT.1 
npm notice package size: 8.4 kB 
npm notice unpacked size: 33.1 kB 
npm notice shasum: bca464e6cd4db1e1358eb8d5cc0fbe6abb4b11b5 
npm notice integrity: sha512-6lvGfgwUzKrwU[...]bFMAWtqSw9N5A== 
npm notice total files: 3 
npm notice
  1. Install package "molina_ms" with following configuration in package.json: "dependencies": { "mcs-common-test": "SNAPSHOT" } Output:
npm install npm notice created a lockfile as package-lock.json. You should commit this file. added 1 package from 1 contributor in 1.408s

In package-lock.json we have:

"dependencies": { "mcs-common-test": { "version": "1.0.0-SNAPSHOT.1"

Looks good.

3.Then we bump a version of "mcs-common-test" and publish it:

$ npm version prerelease 
v1.0.0-SNAPSHOT.3

npm publish --tag SNAPSHOT
npm notice
npm notice  mcs-common-test@1.0.0-SNAPSHOT.3
npm notice === Tarball Contents ===
npm notice 32.3kB index.js
npm notice 620B package.json
npm notice 179B readme.md
npm notice === Tarball Details ===
npm notice name: mcs-common-test
npm notice version: 1.0.0-SNAPSHOT.3
npm notice package size: 8.4 kB
npm notice unpacked size: 33.1 kB
npm notice shasum: a6f4af8bd35fcd9893faea801e6384cc5dab4b3e
npm notice integrity: sha512-0S3XHyoOSUKU9[...]NyB1PQyV0baEw==
npm notice total files: 3
npm notice

mcs-common-test@1.0.0-SNAPSHOT.3
  1. Trying to install "molina_ms" package:
npm install 
up to date in 0.809s

The result - no changes. The new version of "mcs-common-test" wasn't downloaded

Expected Behavior The latest version of dependency mcs-common-test@1.0.0-SNAPSHOT.3 should be installed

Why doesn't npm download the latest version with tag "SNAPSHOT"?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Dr.Crazy
  • 1,623
  • 1
  • 7
  • 8
  • This is a dupe of unanswered https://stackoverflow.com/questions/36575821/npm-install-to-get-dependency-with-tag-version but the comments suggest that you can't use tags for versioning like this – Joe Jun 03 '20 at 18:31
  • But the tag "latest" can be used... Why others not? – Dr.Crazy Jun 15 '20 at 18:06

0 Answers0