npm i --no-cache caches in a false folder of cwd

priority:low
cli
triaged

(Joshua) #1

What I Wanted to Do

Install without using the cache with npm i --no-cache.

What Happened Instead

npm created a false folder in my current directory with the cache data in it.

Reproduction Steps

  1. mkdir test
  2. cd test
  3. npm init -y
  4. npm i --no-cache
  5. ls
  6. See the false folder

Details

Versions:

{ '21088': '1.0.0',
  npm: '6.1.0',
  ares: '1.14.0',
  cldr: '33.0',
  http_parser: '2.8.0',
  icu: '61.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.29.0',
  node: '10.1.0',
  openssl: '1.1.0h',
  tz: '2018c',
  unicode: '10.0',
  uv: '1.20.2',
  v8: '6.6.346.27-node.6',
  zlib: '1.2.11' }

From: https://github.com/npm/npm/issues/21088

I’m assuming this is because npm uses the result of config.get('cache') as the cache dir without checking to make sure it’s actually a string.


(Kat Marchán) #2

I’ve been thinking about this recently and what it’d take to support no-cache installs – basically the main stopper right now is git dependencies, which rely on a cache after building the tarballs to re-fetch them. This is a thing they should probably not be doing in the first place, but requires a bit of juggling.

I believe there’s also a few places where a tmp directory is used inside cache to do some operation or another, and those need to be hunted down.

Finally, everything that uses the cache (pacote, make-fetch-happen) need to be aware that a false means to not cache at all, and that might be either very little work, or a lot of work.

In any case, this is definitely a project, and I’d totally take a PR that does this. It’ll probably require touching several different repos, tho.


(Kat Marchán) #3

I’m gonna move this to #ideas because it’s a feature request in disguise.


(system) #4

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.