npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

tmp directory used for upload

What I Wanted to Do

publish my module using npm 6.2.0

What Happened Instead

it appears to be harvesting data stored in a variable size temp folder of some kind as shown here. i looked in that folder and it contains a bunch of names of programs I use. totally not necessary for publishing an npm module. i’m not able to publish after the upgrade update due to this…

Reproduction Steps

npm install -g npm
cd mylittlepony
npm publish



Platform Info

$ npm --versions
{ 'after-dark': '5.0.0',
  npm: '6.2.0',
  ares: '1.14.0',
  cldr: '33.0',
  http_parser: '2.8.0',
  icu: '61.1',
  modules: '64',
  napi: '3',
  nghttp2: '1.32.0',
  node: '10.4.1',
  openssl: '1.1.0h',
  tz: '2018c',
  unicode: '10.0',
  uv: '1.20.3',
  v8: '',
  zlib: '1.2.11' }
$ node -p process.platform

That’s your tmp directory, controlled by $TMPDIR. If you’ve set that environment variable, it’s likely you’ve got a bunch of different programs writing to it, and if it’s not a tmpfs, it doesn’t get cleaned up. See the setting here:

npm uses your tmp directory for a variety of things while it’s doing its own on-disk work, and it does try to clean up after itself, but various situations can end up leaving a tmp file around (as with any other program). I’m not sure why you’ve got your tmpdir in /var, but that’s why you’re seeing that log line.

And yes, it’s fairly necessary because npm writes the package to disk before it attempts to upload it. This is not an unreasonable thing for it to do :)

Thanks for the concise and contextual response. I was doing some research and found some additional background on /var/folders/. As suggested it’s a $TMPDIR. Honestly I’m surprised I’ve never noticed it before. Given it’s variable size, placement in /var conforms with definitions in the Filesystem Hierarchy Standard. But if it’s being used for highly ephemeral files I need to do a bit more digging. Thanks again.