3

I am publishing artifact to npm repository with a custom tag 'dev-latest'. After executing npm install in a project where I have this dependency defined, the latest version is not updated.

After new artifact is published I see that dev-latest points to the latest version:

npm view @kosmos/equote-lib dist-tags

{ 'dev-latest': '1.0.0-dev20190125.1',
latest: '1.0.0-rel20190122.0',
'rel-latest': '1.0.0-rel20190123.0' }

Locally i have installed previous version. In my package.json my dependency is defined:

"@kosmos/equote-lib": "dev-latest",

after executing npm install to update whole project my package is not updated to the latest version.

When I do npm install @kosmos/equote-lib@dev-latest it will update it but also change my package.json entry to the specific package version.

Other solution is to remove node_modules and the I will get latest version as well.

I would expect that using tag will remove the need of specifying the version in package.json Is there a way to implement the desired behavior ?

Piotr
  • 624
  • 1
  • 9
  • 18

1 Answers1

4

I think I found the good answer here: https://stackoverflow.com/a/19824154/1347496

Basically in case you have already installed the modules locally you should use npm update to update one/all dependencies. In my case while using tags I do

npm update --no-save

to not to overwrite my package.json

Piotr
  • 624
  • 1
  • 9
  • 18
  • For reasons unknown to me, this command has been *deleting* the packages I want to update to the latest snapshot. A subsequent "npm install" puts them back, but I'd really like a command that does it correctly in one go. – Katana314 Jul 30 '20 at 13:55