imagemin: mozjpeg pre-build test failed
not sure if I should be posting this here or in mozjpeg but mozjpeg is failing for me on OS X 10.11:
optipng-bin@3.1.1 postinstall /Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-optipng/node_modules/optipng-bin
> node lib/install.js
✔ optipng pre-build test passed successfully
> mozjpeg@4.1.1 postinstall /Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg
> node lib/install.js
⚠ The `/Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor/cjpeg` binary doesn't seem to work correctly
⚠ mozjpeg pre-build test failed
ℹ compiling from source
✖ Error: autoreconf -fiv && ./configure --disable-shared --prefix="/Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor" --bindir="/Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor" --libdir="/Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-mozjpeg/node_modules/mozjpeg/vendor" && make --jobs=8 && make install --jobs=8
Command failed: /bin/sh -c autoreconf -fiv
/bin/sh: autoreconf: command not found
at ChildProcess.exithandler (child_process.js:213:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:827: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:477:12)
> gifsicle@3.0.3 postinstall /Users/xxx/Sites/white-label/node_modules/gulp-imagemin/node_modules/imagemin-gifsicle/node_modules/gifsicle
> node lib/install.js
✔ gifsicle pre-build test passed successfully
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 6
- Comments: 53 (6 by maintainers)
On MacOS 10.11.6, I did this
brew install automake autoconf libtool dpkg pkgconfig nasm libpng
I don’t know if @bshack is still having problems with that, but I was struggling with the same problem yesterday and I think that I’ve found a solution.
My Scenario: building a project that uses imagemin inside a docker container using alpine linux.
Solution: install the following alpine packages:
After installing that, I was able to compile the binaries.
I don’t know if it helps, but I’m adding it here, so anyone can try this when having same problems.
I got a similar error. Here’s what I did to fix it; hopefully this helps someone else!
brew install nasm
(I was using the bundled OS X version 0.98.40, now using 2.11.08)npm cache clean
npm install
Still getting an error with the cjpeg binary, but the build from source works now.
This bug reproduced on CentOS 6.8 witn node.js v6.9.4. But when I install
yum install wget autoconf automake gcc nasm libtool
, I successfully compiled mozjpegmozjpeg@4.1.1 postinstall /home/bitrix/serv_opti/node_modules/mozjpeg node lib/install.js
⚠ The
/home/bitrix/serv_opti/node_modules/mozjpeg/vendor/cjpeg
binary doesn’t seem to work correctly ⚠ mozjpeg pre-build test failed ℹ compiling from source ✔ mozjpeg built successfullyIt is not Alpine Linux, but may be it will help you to find a right solution .
On Ubuntu 16.04,
sudo apt install nasm
worked for me!if you are using macOS with M1 chip and, getting pre-build failed, you could try following steps and run your installation again. It works for me.
Get Info
Open with Rosseta
, Click close the dialogiTerm
now and, it will ask you to download some updates. Complete the updates.Open with Rosseta
againnpm i mozjpeg
; It should workanyone ever figured how to natively install this in alpine without requiring to build from source?
Still no dice here on CentOS 7.
and then:
@bshack Do you have a Package lock file that was generated from another OS? I faced this issue when a package-lock.json file was created in Windows system and then we tried to deploy the code in Jenkins(Linux) environment. Deleting the package-lock.json file solved the issue for me. Hope this helps
hey guys did you try this ? https://github.com/mozilla/mozjpeg/issues/99#issuecomment-52628719
Okay so just try to npm install imagemin again 😃
That worked for me but you could also cd into node_modules > mozjpeg > test and run node test
That should try to build it but you need to have done what @chrisvanpatten said
Try running also
node node_modules/mozjpeg/lib/install.js
to try the build manuallyThis fixed the source build for me on Mac Sierra:
sudo port install automake autoconf libtool dpkg pkgconfig nasm