Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

cache-min & unknown version #8581

Closed
Closed
@timoxley

Description

@timoxley
Contributor

Currently, if npm is trying to install a package not yet in the npm cache, it will reach out to the registry and grab the package, even with cache-min=Infinity. This is desirable.

This allows high values for cache-min to work well, but a problem occurs in the following scenario:

  1. package A in cache, knows all versions up to v1.0.0.
  2. package A releases version 1.1.0
  3. package B not in cache, gets downloaded
  4. package B requests package A ^1.1.0.
  5. npm install --cache-min=Infinity
  6. npm errors with a "no matching version found" error, listing all versions up to 1.0.0.

To resolve this, one has to update the cache's version info e.g. npm info packagename or lower the cache-min setting. This makes use of high cache-min values particularly error prone, especially on first installs.

It would be good if unknown versions were treated the same as unknown package names, i.e. npm should fall back to checking the remote registry before reporting "no compatible version found".

Activity

timoxley

timoxley commented on Jun 27, 2015

@timoxley
ContributorAuthor

@othiym23 what are your reservations about this?

JamesMGreene

JamesMGreene commented on Aug 27, 2015

@JamesMGreene

Arrrrrgh! I keep running into this, too. 😡

e.g.

npm ERR! Linux 3.14.48-33.39.amzn1.x86_64
npm ERR! argv "node" "/usr/local/bin/npm" "install" "--cache-min=Infinity"
npm ERR! node v0.10.38
npm ERR! npm  v2.13.3
npm ERR! code ETARGET

npm ERR! notarget No compatible version found: yargs@'>=3.19.0 <4.0.0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["1.0.0","1.0.1","1.0.3","1.0.4","1.0.5","1.0.6","1.0.7","1.0.8","1.0.9","1.0.10","1.0.11","1.0.12","1.0.13","1.0.15","1.1.0","1.1.1","1.1.2","1.1.3","1.2.0","1.2.1","1.2.2","1.2.3","1.2.4","1.2.5","1.2.6","1.3.0","1.3.1","1.3.2","1.3.3","2.1.1","2.3.0","3.0.0","3.0.1","3.0.2","3.0.3","3.0.4","3.1.0","3.2.1","3.3.1","3.4.0","3.4.4","3.4.5","3.5.0","3.5.1","3.5.2","3.5.3","3.5.4","3.6.0","3.7.0","3.7.1","3.7.2","3.8.0","3.9.0","3.9.1","3.10.0","3.11.0","3.12.0","3.13.0","3.14.0","3.15.0","3.16.0","3.16.1","3.17.1"]
npm ERR! notarget 
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget 
npm ERR! notarget It was specified as a dependency of 'em'
npm ERR! notarget 

Here, em is a local module, which is also a dependency of another higher-level local module/tool.

iarna

iarna commented on Feb 19, 2016

@iarna
Contributor

We chatted more about this internally and reservations are withdrawn– We would welcome a patch that, if a dependency version lookup failed with a cached version of the package's metdata, tried again with a fresh version. (This may be a bit tricky due to the architecture around the config being a painfully global object, but with sufficient surgery it's plausible.) However, it's not on our timeline for the coming year to add it ourselves.

As such, @othiym23 has marked this patch-welcome, and I'm going to close this issue.

timoxley

timoxley commented on Apr 18, 2016

@timoxley
ContributorAuthor

For the record, I disagree that this issue should be closed, and I disagree with labelling it as a "feature request". It's a race condition bug that sometimes causes a completely valid npm install to fail.

9 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @timoxley@JamesMGreene@othiym23@apaleslimghost@iarna

        Issue actions

          cache-min & unknown version · Issue #8581 · npm/npm