0

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.

Guillermo
  • 1,493
  • 3
  • 16
  • 35
  • On a cache miss, `npm` will go to the registry. What are you seeing that makes you say it is behaving otherwise? – Trott Apr 13 '21 at 12:19
  • @trott today I faced a super weird issue with NPM not being able to see "@babel/traverse@7.15.3", it failed consistently until the IT guys deleted the NPM cache. After that it worked like a charm. – Guillermo Apr 13 '21 at 15:41

1 Answers1

0

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.

Trott
  • 66,479
  • 23
  • 173
  • 212