问题
I have installed gulp-imagemin on my Windows 7 laptop using
npm install --save-dev gulp-imagemin
and after a lengthy process ended up with a folder with well over 10,000 files and some very deep folder structures. Has anyone else seen this? Is it likely to be correct or would I be right in suspecting an issue?
回答1:
Yes it is correct. I've installed it too on my Windows machine and I saw the same thing as you describe here.
The reason it has over 10,000 files and an even more lengthier directory structure is the nature of node modules.
Each and every node module is self containing and has a sub directory node_modules with all it's dependencies. Those dependencies have dependencies as well, resulting in a very deep directory structure.
When I try to remove gulp-imagemin, Windows is even complaining that the directory structure is too large and that it cannot remove certain files. This is because of the MAX_PATH length of 260 characters; see msdn.microsoft.com.
Nevertheless I really, really like this node module and I'm using it in every front end project I work on. Sometimes it takes 2 tries to install it, but I think it's definitely worth it.
On GitHub I have a starter application for working with single page applications; skeletonSPA in which I use it too.
来源:https://stackoverflow.com/questions/29759705/installing-gulp-imagemin-on-windows-creates-well-over-10-000-files