Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the npm tmp directory? Can I delete it?

On a brand new Ubuntu machine 12.04.3 I did the following installations on my home directory:

  • Git: sudo apt-get install git
  • Node.js: sudo apt-get install nodejs and updated it with sudo npm cache clean -f, sudo npm install -g n, sudo n stable
  • npm: sudo apt-get install npm and then updated it with npm update npm -g
  • Yoeman: sudo npm install -g yo

A new "tmp" directory popped up in my home directory with the following structure:

npm-13728-uErqEQ4O:
1392566713336-0.9297236264683306  1392566726706-0.4921755278483033

npm-13763-yoMEDYdC:
1392566864990-0.09957328205928206

Each of the uErqEQ4O subdirectories contain:

tmp.tgz

package:
AUTHORS  configure        html     make.bat  node_modules  scripts
bin      CONTRIBUTING.md  lib      Makefile  package.json  test
cli.js   doc              LICENSE  man       README.md

The yoMEDYdC subdirectory contains:

tmp.tgz

package:
cli.js  package.json  readme.md  scripts  yeoman.txt  yoyo.js

What is this tmp npm directory and everything inside it? Why was it generated?

Can I delete it? If not, where can I move it to because I don't want it in my home directory?

like image 472
randwa1k Avatar asked Feb 16 '14 16:02

randwa1k


1 Answers

Tmp or temp generally means some kind of temporary storage, which is auto generated by program (mostly per one session):

Here is what the npm tmp directory is:

Temporary files are stored by default in the folder specified by the tmp config, which defaults to the TMPDIR, TMP, or TEMP environment variables, or /tmp on Unix and c:\windows\temp on Windows.

Temp files are given a unique folder under this root for each run of the program, and are deleted upon successful exit.

If you are not sure can you delete it, just add some prefix to it e.g. _tmp and try to run you app. If it runs with prefix then you can delete it. If not, then you app has some kind of reference to it.

like image 134
Miroslav Trninic Avatar answered Sep 28 '22 09:09

Miroslav Trninic