imagemin / imagemin-pngquant

Imagemin plugin for `pngquant`
MIT License
316 stars 81 forks source link

Binary doesnt seem to work #40

Closed sweetsamy21 closed 5 years ago

sweetsamy21 commented 7 years ago

Hi there,

I installed the above plugin and used it in my gulp task to minify images. works like a charm on my local machine. When I deploy the same code in production environment, I get the following issues. Please help...!!

/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly

Error: pngquant failed to build, make sure that libpng-dev is installed

Do I have to add another npm like libpng-dev in my package.json?

jagged3dge commented 7 years ago

libpng-dev is a linux package. It is required to build/compile the binary executable of pngquant on your production box during the package's installation phase. This binary executable is re-built at every fresh installation of a version the npm package because it uses native OS C++ bindings to fully optimize the minification process.

You may look up the docs of your deployment machine's OS flavour for whichever package manager is used to install the libpng-dev package before you try to install this lib via npm.

For example: On CentOS/RHEL, you'd use yum package manager, like sudo yum install libpng-dev, wait for it to complete, then do npm install. On Ubuntu, you'd use sudo apt install libpng-dev, then npm install.

rico-ocepek commented 6 years ago

Also try to restart your machine after installing the libpng-dev package - this helped in my case.

francosalcedo commented 6 years ago

reboot it worked for me <3 !

thegbom commented 6 years ago

I upgraded ubuntu, and upgraded npm and node. Then it worked just fine.

natanr123 commented 5 years ago

I am not sure it is related but the problem was solved for me after adding .dockerignore with node_modules