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
Description
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:
- package A in cache, knows all versions up to v1.0.0.
- package A releases version 1.1.0
- package B not in cache, gets downloaded
- package B requests package A ^1.1.0.
npm install --cache-min=Infinity
- 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 commentedon Jun 27, 2015
@othiym23 what are your reservations about this?
JamesMGreene commentedon Aug 27, 2015
Arrrrrgh! I keep running into this, too. 😡
e.g.
Here,
em
is a local module, which is also a dependency of another higher-level local module/tool.iarna commentedon Feb 19, 2016
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 commentedon Apr 18, 2016
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