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

10,169

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.

Share:
10,169
randwa1k
Author by

randwa1k

not knowing is okay. not trying is not. even if it's a random walk. getting stuck is not okay. use another way. it's again a random walk..

Updated on July 26, 2022

Comments

  • randwa1k
    randwa1k almost 2 years

    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?

  • randwa1k
    randwa1k about 10 years
    Thanks! How come it's not deleted though?