Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does npm delete downloaded module if the installation fails?

Tags:

npm

When I try to install something with npm it fails quite often (much more often that apt-get for example), and it will display "see log file for details" or "make in the directory failed". But when I try to inspect the directory said it will not be found. Does NPM simply delete every thing it just downloaded if anything fails during installation? Why would it tell me to check the directory then if it deleted it?

like image 642
exebook Avatar asked Oct 21 '22 13:10

exebook


1 Answers

npm keeps downloaded packages as tarballs inside a cache folder.

see: https://www.npmjs.org/doc/cli/npm-cache.html

When you run npm install and something goes wrong, it will try to undo and remove the packages from your current location, but it should leave the cached tarballs alone. Sometimes the cache can have a bad package-tarball.

You can force npm to install without using the cache like this npm install --force. Or, if you really must, you can clear out the whole cache like this npm cache clean.

Remember: npm installs packages into the current folder, or wherever your package.json can be found

like image 142
Ponelat Avatar answered Oct 24 '22 00:10

Ponelat