slushjs / gulp-install

Automatically install npm and bower packages if package.json or bower.json is found in the gulp file stream respectively
MIT License
106 stars 46 forks source link

Gulp-install fails silently with more than 16 package.json files #38

Closed cyberixae closed 7 years ago

cyberixae commented 8 years ago

I am working on a Serverless project that has lots of separately deployable components. Each of these components has their own package.json file. I created a gulp task that uses gulp-install to install dependencies for all of the modules in one go. However this only worked until we reached the magic limit of 17 package.json files. When this happens gulp-install will stop installing packages but will not produce any error message to indicate that something went wrong.

cyberixae commented 8 years ago

I believe the problem is somehow related to the ​high water mark​ of 16 items in Node streams.

cyberixae commented 8 years ago

I created an example project for testing. See https://github.com/cyberixae/gulp-install-test

davidchase commented 8 years ago

@cyberixae it is related to high water mark​ of 16 , gulp-install uses through2 #L30 in object-mode which sets the hwm to 16 for the default.. the reason you cannot process more than 17 files is because you are adding files readable part of through2 module and its hitting the buffer limit. based on your test repo you need to drain the readable part by doing something like pipe(install()).pipe(...) then you can process more than aforementioned file limit

cyberixae commented 8 years ago

Actually, we ended up using the Serverless AutoInstall Plugin, so this bug thread is no longer relevant for me. The plugin can be found at https://www.npmjs.com/package/serverless-plugin-autoinstall if someone else has the same use case.

sloppylopez commented 8 years ago

Hi, I have a similar issue, in my case it fails silently for versions 0.5.0 and 0.6.0 but i do not have 16 package.json, the problem is that I am not using Serverless so I cannot avoid the problem so easily, surprisingly for me, If i use gulp-install 0.4.0 it works like a charm...

Off course I can avoid the problem not using gulp-install and executing the command in another kind of fashion like var child = spawn('npm', ['install'], {cwd: process.cwd()}); but i was really wanting to do it the 'gulp-way'. But now that i know it's an open issue maybe I will try the lousy solution until someone gives more info about this cos I cannot get stuck in a minor thing like this.

joakimbeng commented 7 years ago

Sorry for the great delay! A fix for this is on its way...