Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minifying GIF - stdout maxBuffer exceeded #360

Open
thany opened this issue Jun 10, 2020 · 5 comments
Open

minifying GIF - stdout maxBuffer exceeded #360

thany opened this issue Jun 10, 2020 · 5 comments

Comments

@thany
Copy link

thany commented Jun 10, 2020

When minifying a bunch of gifs from the command line, I get this error at some point:

MaxBufferError: stdout maxBuffer exceeded
    at PassThrough.<anonymous> (C:\Users\[snip]\get-stream\index.js:41:19)
    at PassThrough.emit (events.js:327:22)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at PassThrough.Readable.push (_stream_readable.js:212:10)
    at PassThrough.Transform.push (_stream_transform.js:152:32)
    at PassThrough.afterTransform (_stream_transform.js:96:10)
    at PassThrough._transform (_stream_passthrough.js:46:3)
    at PassThrough.Transform._read (_stream_transform.js:191:10)
    at PassThrough.Transform._write (_stream_transform.js:179:12)

What's also not great about this, is that all other gifsicle processes are nuked as well when this happens. It might be useful to know, the biggest gif in the collection I'm minifying, is about 33MB. I'm not sure if that's the one it fails on. I don't know which one is causing this crash.

I'm on Node.js 12.18 and imagemin-cli 6.0.0.

Edit: it appears to crash even on files that are less than 10MB

@exil0867
Copy link

I'm having the same issue.

@MatheusR42
Copy link

Same here

@Mr-Thunder
Copy link

I too am having the same issue
(node:16700) UnhandledPromiseRejectionWarning: MaxBufferError: stdout maxBuffer exceeded

node 14.5 and gulp

@cyberjam
Copy link

Same here

@cyberjam
Copy link

cyberjam commented May 9, 2024

I solved it this way.

YOUR_PROJECT/node_modules/imagemin-gifsicle/index.js

  • Before
        const {stdout} = await execa(gifsicle, args, {
		encoding: null,
		input,
	});
  • After
        const {stdout} = await execa(gifsicle, args, {
		encoding: null,
                maxBuffer: Number.POSITIVE_INFINITY,
		input,
	});

If you want to keep the changes, you can use patch-package.

ref : imagemin/imagemin-gifsicle#51 , imagemin/imagemin-gifsicle#46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants