Cli: Package.json with dependencies "latest" does not download latest

Created on 24 Apr 2020  ·  3Comments  ·  Source: npm/cli

npm version: 3.10.10
Scenario: I uploaded a jar to my private npm repo with version 1.2.0. Now for some reason, I added a new jar with version 1.1.0.
My package.json has a dependency "XYZ": "latest". But it downloads 1.1.0? Is this a bug or I am doing something not right? I was expecting it to download 1.2.0 always.

Most helpful comment

Sorry my bad, I meant tarballs (and not jars).

All 3 comments

what's a jar? npm deals in tarballs.

"latest" is a dist-tag; a version has to be explicitly set to it. When backporting (as you've done), it's easy to accidentally set the older version as "latest".

I'd suggest using https://npmjs.com/safe-publish-latest to avoid this in the future; to fix this now, run npm dist-tag add [email protected] latest

Sorry my bad, I meant tarballs (and not jars).

That solution works. Thanks a lot.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisspen picture chrisspen  ·  3Comments

1000i100 picture 1000i100  ·  3Comments

ahuglajbclajep picture ahuglajbclajep  ·  3Comments

darcyclarke picture darcyclarke  ·  3Comments

Cohen-Carlisle picture Cohen-Carlisle  ·  4Comments