imagemin / pngquant-bin

pngquant bin-wrapper that makes it seamlessly available as a local dependency
http://pngquant.org
Other
115 stars 95 forks source link

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

Closed wawanopoulos closed 2 years ago

wawanopoulos commented 6 years ago

I'am getting this error today when i try to make a npm update on my project:

pngquant-bin@4.0.0 postinstall /var/www/palm/20180315202846/node_modules/pngquant-bin

node lib/install.js

⚠ The /var/www/pp/20180315202846/node_modules/pngquant-bin/vendor/pngquant binary doesn't seem to work correctly ⚠ pngquant pre-build test failed ℹ compiling from source ✔ pngquant pre-build test passed successfully ✖ RequestError: pngquant failed to build, make sure that libpng-dev is installed at ClientRequest.req.once.err (/var/www/pp/20180315202846/node_modules/pngquant-bin/node_modules/got/index.js:111:21) at Object.onceWrapper (events.js:272:13) at ClientRequest.emit (events.js:180:13) at ClientRequest.onConnect (/var/www/pp/20180315202846/node_modules/pngquant-bin/node_modules/tunnel-agent/index.js:168:23) at Object.onceWrapper (events.js:272:13) at ClientRequest.emit (events.js:180:13) at Socket.socketOnData (_http_client.js:476:11) at Socket.emit (events.js:180:13) at addChunk (_stream_readable.js:269:12) at readableAddChunk (_stream_readable.js:256:11) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! pngquant-bin@4.0.0 postinstall: node lib/install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the pngquant-bin@4.0.0 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. ^C npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2018-03-15T20_19_09_479Z-debug.log

I already install libpng-dev library, and i always get this error.

mikemand commented 6 years ago

@s17billsp: My CentOS server has libpng-devel v1.5.13 already and things are not working. I will attempt to fix the version of imagemin-pngquant to 5.0.0 and see what happens.

jhill-dci commented 6 years ago

@skatetdieu yum installing libpng-devel fixed this for me on RHEL 7. THANK YOU!

mikemand commented 6 years ago

Setting imagemin-pngquant to 5.0.0 did not work. I've run out of time, knowledge, and patience to fix this issue.

I'm compiling assets locally and then committing them in git, instead. This is ridiculous.

svallamsetti commented 6 years ago

I managed to fix this[temporarily] on CentOS 6 using npm shrinkwrap command. This helps us to manage the inter-dependencies.

  1. Set the imagemin-pngquant to version "5.0.0" i.e "imagemin-pngquant": "5.0.0"
  2. Remove the "pngquant-bin": "3.1.1" dependency from imagemin-pngquant requires and define the dependency as below "dependencies": { "pngquant-bin": { "version":"3.1.1" } }
  3. Similarly, remove the "imagemin-pngquant": "5.0.1" dependency from "img-loader" requires and define the dependency as below "dependencies":{ "imagemin-pngquant": { "version":"5.0.0" } }
  4. run npm shrinkwrap

Note: this command is useful only once and for the second time it replaces the npm-shrinkwrap.json file with latest available dependencies. Moreover, I used this to avoid the current issue I'm facing only on CI server. So I only ran npm shrinkwrap when I want a build to happen.

softwaredeveloperca commented 6 years ago

For Ubuntu I used: wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb \ && sudo dpkg -i /tmp/libpng12.deb \ && rm /tmp/libpng12.deb

mashhur commented 6 years ago

similar problem here with macOS... anybody has a workaround?

RequestError: pngquant failed to build, make sure that libpng is installed.

PS: comes from laravel-mix install. Tried : $brew install libpng

checked whether installed or not. brew info libpng Result: libpng: stable 1.6.34 (bottled), HEAD Library for manipulating PNG images http://www.libpng.org/pub/png/libpng.html /usr/local/Cellar/libpng/1.6.23 (25 files, 1.2MB) Poured from bottle on 2016-07-01 at 22:28:13 /usr/local/Cellar/libpng/1.6.34 (26 files, 1.2MB) * Poured from bottle on 2018-03-28 at 10:31:39 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/libpng.rb ==> Options --HEAD Install HEAD version

$brew install pngquant then removed node_modules folder and tried $npm install

So, after restarting macOS (and npm install), finally it worked :)

ngoctp commented 6 years ago

The issue comes from new release of imagemin-pngquant v5.1 requires pngquant-bin@4.0.0 The quick fix is to downgrade imagemin-pngquant to 5.0.* which is using pngquant-bin@3.1.1

Run this command and commit your package.json npm install --save-exact imagemin-pngquant@5.0.*

Advaith3600 commented 6 years ago

I managed to fix this problem by installing libpng-dev in Ubuntu 17.10. Just run sudo apt install libpng-dev and then npm update

digitaltim-de commented 6 years ago

same problem on centos i tried all... yum install libpng-devel.. installed then run npm again, error.

mythrnr commented 6 years ago

I think it will not be a fundamental solution and not be applied to all, but I was able to install it with the --force option (using Docker's node: 9.3.0-alpine image)

victorvoronin commented 6 years ago

same problem on centos i tried all... yum install libpng-devel.. installed then run npm again, error.

I have installed all packages with libpng in title on Centos. It works for me # yum install libpng* -y

rangermeier commented 6 years ago

same problem here on Fedora 27, managed to get it to work by installing libpng12 and libpng12-devel # dnf install libpng12 libpng12-devel

Cameron-Carlin commented 6 years ago

@rangermeier your suggestion worked wonderfully! Thank you!

magemaniac33 commented 6 years ago

@rangermeier Works perfect, thank you!

cristim commented 6 years ago

I'm still struggling to get this work on CentOS6, the recommended yum install libpng* -y doesn't just work.

As a workaround I'm now trying to perform the npm install in two steps: once inside the devtoolset in order to install most modules, then exit the devtoolset and run it again just for pngquant-bin, something like this:

echo 'npm install || true' | scl enable devtoolset-3 bash
npm install || true

I'll report back once I have some results.

Later edit This did the trick for us, our build is now green.

abetwothree commented 6 years ago

@cristim I used it on CentOS but had to install libpgn-devel with yum instead of libpng.

cristim commented 6 years ago

@skatetdieu I have installed all the libpng packages, including libpng-devel. As I said, the problem in my case seems to be caused by the devtoolset. It works without it for pngquant-bin, but I need it for other native packages that I require a C++11 compiler.

abetwothree commented 6 years ago

@cristim hmm, yeah I don't know how to resolve that. I just installed libpng-devel and it worked for me.

mybigman commented 6 years ago

Still not working on Debian 9.4 :(

Any ideas when it will be resolved?

bytemofan commented 6 years ago

same problem to me! I fixed it use this:

  1. mofidy package.json
    ...
    "image-webpack-loader": "^4.2.0",
    "imagemin-pngquant":"5.0.0",
    "pngquant-bin":"3.1.1",
    ...
  2. run this bash:
    yum install -y gcc gcc-c++ make openssl-devel libpng libpng-devel

    I don't know why so solved!

hubo1016 commented 6 years ago

It seems that the pre-compiled binary is linking to libpng12, so you must install libpng12 to allow the pre-compiled to work

on CentOS 7:

yum install -y libpng12

Or install the libpng-devel to build it

yum install -y libpng-devel

as well as other dependencies (gcc, make, ...)

hubo1016 commented 6 years ago

It's funny that this binary has been uploaded for three years, and was broken at least for 4 months (#73) because new OS are shipping libpng15 instead of libpng12, but still not noticed until v4.0.0...

cristim commented 6 years ago

If we do ship binaries, can't we ship a static binary instead of linking and then depending on whatever is available on the host?

hasusuf commented 6 years ago

I was able to solve this issue on my node:9-alpine container by installing the following apk add --no-cache make gcc g++ libc-dev libpng-dev bash or apk add --no-cache bash alpine-sdk libpng-dev if you don't care about the images' size.

yyynnn commented 6 years ago

some help for windows users will be appreciated

bokideckonja commented 6 years ago

I ran: sudo apt-get install libpng-dev before npm install and it solved it for me.

Hope it helps.

bwml commented 6 years ago

On Centos 7 | NPM 3.10.10 | Node v6.14.0 This worked for me: sudo yum install libpng-devel

chasebolt commented 6 years ago

i am also hitting this same issue. it appears during install this package does a call over to http://pngquant.org and denying the connection. testing with telnet pngquant.org tells me to visit http://sblam.com

the connection denied to their main site is currently failing the install.

1525392226.494      0 172.22.6.8 TCP_DENIED/200 0 CONNECT pngquant.org:80 - HIER_NONE/- -
3kynox commented 6 years ago

I'm on debian 9.4, none of the above workarounds works.

Repo owner, please merge available PR's and correct this please.

Laravel-mix / Spark installations completely unavailable because of this!

rico-ocepek commented 6 years ago

Same here on Alpine3.7, yarn install wont work - one of the most annoying issues out there right now I am expiriencing it with every new installation on every new OS and still don't have a fix that just works everywhere..

robindirksen1 commented 6 years ago

For Laravel/Spark users, see this comment (CentOS): https://github.com/JeffreyWay/laravel-mix/issues/1611#issuecomment-387254894 - this fixed it for me.

ragonzalezm19 commented 6 years ago

This work for me, Ubuntu 18.04 https://stackoverflow.com/a/49465604

tyler36 commented 6 years ago

Same issue for me on Win10

pkbhuiyan commented 6 years ago

In my case: 1.npm update gulp 2.npm install

and that solve in my case... :P

misterspelik commented 6 years ago

Hi guys also take a note that this issue can be related to non-existing swap partition at your VMs. I just created it it started to work. https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04

pkarjala commented 6 years ago

@ragonzalezm19 Thank you, manually installing the older libpng12 version fixed the issue for me on Ubuntu 18.04.

dejwoo commented 6 years ago

If anyone is struggling in Debian 9(Stretch) or Debian based Docker container,

apt-get -y install libpng* nodejs make gcc g++ libc-dev bash

has solved the issue for me. After that npm install successfully installed pnguant-bin

carcinocron commented 6 years ago

This work for me, Ubuntu 18.04 https://stackoverflow.com/a/49465604

wget -q -O /tmp/libpng12.deb http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb \
  && sudo dpkg -i /tmp/libpng12.deb \
  && rm /tmp/libpng12.deb
james-nesbitt commented 6 years ago

@InstanceOfMichael is there any reason that you used http instead of https?

moff commented 6 years ago

Had the same issue on Ubuntu 18.04, fixed with sudo apt install libpng-dev

simonj commented 6 years ago

@moff Thanks worked for me too :)

skeeith commented 6 years ago

16.04 LTS, 17.04 or 18.04 LTS

install the following

sudo apt install libpng* build-essential gcc make autoconf libtool pkg-config nasm

OR copy this

"sudo apt install libpng* build-essential gcc make autoconf libtool pkg-config nasm"

after installation of packages.

delete node_modules folder and package-lock.json file. run npm install.

you're welcome.

ravanscafi commented 6 years ago

This worked for me, using node:alpine (by this time, 10.5.0)

FROM node:alpine

RUN apk add --no-cache --update make gcc g++ libc-dev libpng-dev automake autoconf libtool
ak520hl commented 6 years ago

centos 7.4 i run this script " yum install libpng-devel " and delete the folder 'node_modules' and rerun npm install , finally got success .

Bwilliamson55 commented 6 years ago

@InstanceOfMichael and @ragonzalezm19 Installing the older version worked on Ubuntu 18.04 LTS server- for laravel 5.6.

siddharthlatest commented 6 years ago

Any updates on this? Has there been a new release which fixes this?

As some others have pointed, my use of pngquant isn't direct and I'm unable to make any changes. If you push a patch release fixing this, it should start working for everyone who's using this indirectly.

Tohsig commented 6 years ago

Ran into this on CentOS 7.5 using yarn. Stumbled across issue #77 and realized I needed libpng12 and libpng12-devel. Install is working now.

anaxamaxan commented 6 years ago

Solution listed by @skeith69 worked for me using Ubuntu 18.04 LTS on Windows WSL with a fresh Laravel 5.6 install.

benallfree commented 6 years ago

Centos 6.10

sudo yum install -y gcc make libpng-devel
yarn
brickgale commented 6 years ago

getting an error on running npm install -g pngquant-bin. running this command instead npm install -g pngquant-bin --allow-root --unsafe-perm=true. got this from issue #81