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

7.0.0 errors with EPIPE #28

Closed
danez opened this issue Jan 18, 2018 · 17 comments
Closed

7.0.0 errors with EPIPE #28

danez opened this issue Jan 18, 2018 · 17 comments

Comments

@danez
Copy link

danez commented Jan 18, 2018

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:

3sat

@magmel48
Copy link

magmel48 commented Mar 5, 2018

have the same issue

@soptimizer
Copy link

sama issue

@adenvt
Copy link

adenvt commented Mar 29, 2018

same issue

@adenvt
Copy link

adenvt commented Mar 29, 2018

i not very sure, but fix after sudo apt-get install libpng16-dev

@kirylrb
Copy link

kirylrb commented Apr 10, 2018

@adenvt Dziakui, advent.

@flexdinesh
Copy link

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 whitelist

libpng16-dev is not in the whitelist yet and I have created a new whitelist request for libpng16-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 file

os: osx

And everything will work like a charm! 🎉

@rutger1140
Copy link

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

@BenzLeung
Copy link

BenzLeung commented Jun 16, 2018

I have the same issue but I just found a new solution.

"mozjpeg": "^5.0.0"

Just upgrade mozjpeg to the latest 6.0.0 version.

If you use yarn instead of npm , you can add the following code to your project's package.json to temporarily resolve this issue:

"resolutions": {
    "imagemin-mozjpeg/mozjpeg": "^6.0.0"
}

I hope the author will update as soon as possible.

@usamamashkoor
Copy link

same issue.

@yesworld
Copy link

have the same issue :(

@john-codeworx
Copy link

same issue, downgrading to ^6.0.0 fixed it.

@hua1995116
Copy link

I use npm i it break when download imagemin-mozjpeg .

/node_modules/mozjpeg/vendor/cjpeg` binary doesn't seem to work correctly
  ⚠ mozjpeg pre-build test failed
  ℹ compiling from source

But i use npm i imagemin-mozjpeg@6.0.0 it fixed.

@gbiryukov
Copy link

looks like this issue is solved in 8.0.0

@kernel72
Copy link

Nope. Experiencing the same issue for some jpg files in 8.0.0. After downgrade to 6.0.0 issue has gone.

@quinncomendant
Copy link

I have the same issue, and fixed it by downgrading to 6.0.0. I tried to install libpng16-dev, but it is not available on CentOS 7.

/node_modules/mozjpeg/vendor/cjpeg` binary doesn't seem to work correctly
  ⚠ mozjpeg pre-build test failed
  ℹ compiling from source

@hua1995116, I had this error, it was solved by yum install libpng12-devel.

@Sdcrow
Copy link

Sdcrow commented Nov 14, 2019

For those using the gulp version gulp-imagemin I faced this issue running "gulp-imagemin": "2.4.0" and I resolved it with the following steps

npm cache clean -f
npm install

I hope this helps someone

@xshapira
Copy link

After hours of research and experimenting with different settings, I managed to resolve mozjpeg errors when using Linux/Docker. The issue is particularly when using alpine image.

My updated Dockerfile:

FROM node:12-buster-slim

RUN npm i npm@latest -g

WORKDIR /usr/src

COPY ./app/package*.json ./

RUN apt-get update && apt-get install -y --no-install-recommends \
    autoconf \
    automake \
    g++ \
    libpng-dev \
    make\
    nasm \
    -y wget \
    && wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb \
    && dpkg -i /tmp/libpng12.deb \
    && rm /tmp/libpng12.deb \
    && npm install --no-optional && npm cache clean --force \
    npm install -g gulp \
    && npm install gulp

ENV PATH /usr/src/node_modules/.bin/:$PATH

WORKDIR /usr/src/app

COPY . .

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!

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