Bypass NPM cache, if the module that I'm looking for is not there

1.3k Views Asked by At

While working with NPM and its cache, I noticed that -sometimes- when the newest version of a certain package is not in the cache, npm ci errors out without bypassing NPM cache.

Is there a way to tell NPM something like "If the package you're looking for is not in the cache, then bypass the cache and try again"?

Thanks in advance.

1

There are 1 best solutions below

0
On

On a cache miss, npm will go to the registry. Cache corruption can cause weirdness, although recent versions of npm handle cache corruption fairly robustly. When in doubt, as you mention in your comment, deleting the cache can fix things, although the npm docs suggest avoiding it if at all possible. Use npm cache clean (or npm cache clear or npm cache rm) to clear the cache.