imagemin-mozjpeg icon indicating copy to clipboard operation
imagemin-mozjpeg copied to clipboard

Incompatible library version: cjpeg

Open joepagan opened this issue 8 years ago • 6 comments

Hi,

I'm trying to run mozjpeg with gulp, but I get this error:

[00:13:17] Starting 'minify-jpgs'...

events.js:141
      throw er; // Unhandled 'error' event
      ^
Error: dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
  Referenced from: /Users/username/Documents/sites/website.com/node_modules/mozjpeg/vendor/cjpeg
  Reason: Incompatible library version: cjpeg requires version 36.0.0 or later, but libpng16.16.dylib provides version 27.0.0

    at ChildProcess.exithandler (child_process.js:203:12)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:817:16)
    at Socket.<anonymous> (internal/child_process.js:319:11)
    at emitOne (events.js:77:13)
    at Socket.emit (events.js:169:7)
    at Pipe._onclose (net.js:469:12)

It manages to install ok, here is my task in full:

gulp.task("minify-jpgs", function(){
    return gulp.src([
        "./images/tester.jpg",
    ])
    .pipe(imagemin([
        imageminMozjpeg({
            progressive: true,
            quality: 80
        })
    ]))
    .pipe(gulp.dest("./images/mozjpeg"));
});

I am not sure what to do about this, can't find a similar issue anywhere. Do you have any suggestions?

joepagan avatar Oct 07 '16 23:10 joepagan

Getting the same error, but not when using Gulp. It turned out that installing libpng via Homebrew corrected it.

brew install libpng

However, I'm not sure why this is happening. Does this package not also include this utility?

aaronbushnell avatar Mar 30 '17 20:03 aaronbushnell

$ brew upgrade libpng

resolved this issue for me

gbiryukov avatar Jun 21 '17 12:06 gbiryukov

$ brew install libpng $ brew update libpng It's resolved, but the resolution is too inferior...

xiaoyaozi1010 avatar Jan 08 '18 03:01 xiaoyaozi1010

I'm getting this on an EC2 server, brew is not an option and I do have the latest libpng installed.

jdavidbakr avatar Mar 01 '18 14:03 jdavidbakr

This is how I solved this issue on EC2, it seems that the proper version of libpng is not installed via yum. Downloading and compiling from source gives me the library I need.

git clone https://github.com/glennrp/libpng
cd libpng
./autogen.sh
./configure
make
make install
cd /usr/lib64/
ln -s /usr/local/lib/libpng16.so.16
ln -s /usr/local/lib/libpng16.so

jdavidbakr avatar Mar 01 '18 14:03 jdavidbakr

Upgrading to version 7 or higher of this library resolves the issue for me.

colinodell avatar Jun 28 '19 20:06 colinodell