imagemin-mozjpeg: 7.0.0 errors with EPIPE
We receive this error after updating to 7.0.0 on our ci server (Ubuntu 16)
Warning: Error: write EPIPE in file x.jpg
After downgrading to 6.0.0 it works again. It also works with newer version on macOS
Gruntfile.js
...
imagemin: {
options: {
optimizationLevel: 7,
progressive: true,
interlaced: true,
svgoPlugins: [
{ removeTitle: true },
{ removeDesc: { removeAny: true } },
],
use: [
imageminMozjpeg({ quality: 80 }),
imageminPngcrush({ reduce: false }),
],
},
static: {
files: [
{
expand: true,
src: [
'webroot/images/**/*.{png,jpg,gif,svg}',
],
},
],
},
...
installed packages:
├─ grunt-contrib-imagemin@2.0.1
├─ imagemin-gifsicle@5.2.0
├─ imagemin-jpegtran@5.0.2
├─ imagemin-mozjpeg@7.0.0
├─ imagemin-optipng@5.2.1
├─ imagemin-pngcrush@5.1.0
├─ imagemin-svgo@5.2.4
├─ imagemin@5.3.1
├─ mozjpeg@5.0.0
I guess it might be because of #16 which made it into 7.0.0 although it was reverted in #17, but the revert seems it was force pushed away or somehow else removed from history. Was that on purpose?
This is the image:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 12
- Comments: 17
I have the same issue but I just found a new solution.
https://github.com/imagemin/imagemin-mozjpeg/blob/005b789088921493ea9968570562f59e10c5e838/package.json#L46
Just upgrade
mozjpeg
to the latest6.0.0
version.If you use
yarn
instead ofnpm
, you can add the following code to your project’spackage.json
to temporarily resolve this issue:I hope the author will update as soon as possible.
i not very sure, but fix after
sudo apt-get install libpng16-dev
Nope. Experiencing the same issue for some jpg files in
8.0.0
. After downgrade to6.0.0
issue has gone.same issue, downgrading to ^6.0.0 fixed it.
After hours of research and experimenting with different settings, I managed to resolve
mozjpeg
errors when using Linux/Docker. The issue is particularly when usingalpine
image.My updated Dockerfile:
These settings might save you hours of frustration. BTW Node’s
alpine
image is NOT recommended because of long build time, even though it’s small image size.Happy coding!
I have the same issues, when running this from a GitLab CI runner. My buildchain uses the official Docker node (node:6 and node:8) and both give the
Error: write EPIPE
.Tried Installing libpng16-dev with
sudo apt-get install libpng16-dev
doesn’t work, since the Node Docker containers are based on Debian.Also installing
nasm
doesn’t work.Workaround When I exclude the
plugins: [imageminMozjpeg({ quality: 75 })]
, it works. When I downgrade to"imagemin-mozjpeg": "~6.0.0"
, it works.Note: I’m running this in a Sage project.
Possibly related: #26
For anyone who’s trying to get this to work in Travis build,
sudo apt-get install libpng16-dev
won’t work as travis containers have a whitelist of packages - ubuntu-trusty whitelistlibpng16-dev
is not in the whitelist yet and I have created a new whitelist request forlibpng16-dev
- libpng16-dev whitelist request. So until it is whitelisted we won’t be able to get it work work in trusty containers.As an alternative, I switched to osx environment temporarily to get this to work. Add this line to you
travis.yml
fileos: osx
And everything will work like a charm! 🎉