2

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?

PedroKTFC
  • 745
  • 10
  • 28

1 Answers1

2

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.

Elger van Boxtel
  • 1,030
  • 12
  • 23
  • could it take over half an hour to install gulp-imagemin? I ran npm install imagemin about half an our ago and it seems to be not doing much, but there is no error message – Oliver Watkins Nov 30 '15 at 09:13
  • @OliverWatkins installing imagemin could take up some time, especially on older NodeJS versions. When using nodeJS version 4 or 5 speeds up things. Try installing a newer version of nodeJS. Hope that fixes your problem... – Elger van Boxtel Nov 30 '15 at 09:19
  • but, half an hour+ (..still going)? does that sound normal? I am just trying to figure out if it has crashed – Oliver Watkins Nov 30 '15 at 09:24
  • No, that doesn't sound as a normal install.. Do you still have disc activity? Otherwise, try to remove your node_modules folder and try again... – Elger van Boxtel Nov 30 '15 at 09:25
  • Whcih nodeJS version are you using? Version 4 and 5 have some real improvements regarding depending tasks. Installing gives you a nice flat list of dependencies, so you won't have any trouble with Windows' 260 characters path limitation ;-) Please let me know if you got it to work – Elger van Boxtel Nov 30 '15 at 10:02
  • the latest brand spanking new one: 4.2.2. But this still installs 260+ deep file structures. Still haven't got it to work.... I am thinking it may have something to do with windows admin rights here at my work..? – Oliver Watkins Nov 30 '15 at 10:09
  • 1
    Use the latest stable nodeJS 5.* release. It uses an updted npm which installs dependencies maximally flat. See release notes: https://github.com/npm/npm/blob/master/CHANGELOG.md#flat-flat-flat – Elger van Boxtel Nov 30 '15 at 10:17