sindresorhus / gulp-imagemin

Minify PNG, JPEG, GIF and SVG images
MIT License
1.9k stars 156 forks source link

Error code when writing large number of optimizations #320

Closed jcklpe closed 5 years ago

jcklpe commented 5 years ago

The error message I receive is this:

(node:10207) UnhandledPromiseRejectionWarning: Error: Premature end of JPEG file

    at Promise.all.then.arr (/{{redactedinfo}}/wp-content/themes/jackalope/node_modules/execa/index.js:231:11)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)
(node:10207) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:10207) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
sindresorhus commented 5 years ago

The most likely reason is that some of your images are corrupt or some are not even JPEG images.

https://stackoverflow.com/questions/12438813/premature-end-of-jpeg-file

You can use https://github.com/sindresorhus/gulp-debug to see what's in your Gulp stream.