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 3 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.

fifthsage commented 6 years ago

I have same case.

it suddenly comes up last night.

mybigman commented 6 years ago

same issue :(

thecodejack commented 6 years ago

anyone got any resolution for this?

facing similar error

\u26a0 unable to get local issuer certificate
  \u26a0 pngquant pre-build test failed
  \u2139 compiling from source
  \u2714 pngquant pre-build test passed successfully
  \u2716 RequestError: pngquant failed to build, make sure that libpng-dev is installed
    at StdError (/frontend/node_modules/pngquant-bin/node_modules/got/index.js:410:3)
    at /frontend/node_modules/pngquant-bin/node_modules/got/index.js:430:3
    at ClientRequest.req.once.err (/frontend/node_modules/pngquant-bin/node_modules/got/index.js:111:21)
    at ClientRequest.g (events.js:292:16)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at TLSSocket.socketErrorListener (_http_client.js:310:9)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:188:7)
    at emitErrorNT (net.js:1281:8)
taxes-frontend@0.2.4/frontend

cc: @sindresorhus

anthonyaam commented 6 years ago

I have the same problem beginning yesterday.

danherd commented 6 years ago

Has anyone got a temporary fix for this?

anthonyaam commented 6 years ago

@danherd use pngquant-bin 3.1.1 for now.

danherd commented 6 years ago

@anthonyaam alas, this package is a dependency of a dependency of a dependency... and the version being used is not something I can control!

anthonyaam commented 6 years ago

@danherd if you have someone on your project that hasn't run npm update yet you could have them check in a package-lock.json file that references pngquant-bin 3.1.1.

If that's not an option then your situation becomes more difficult...I think you'll have to submit PRs to update the dependencies you're importing or just wait for this root issue to be resolved...

danherd commented 6 years ago

@anthonyaam yeah I think I can probably wait it out - funnily enough, even with this error being displayed on yarn install --production, all my assets seem to build OK anyway!

wawanopoulos commented 6 years ago

Could you please provide a quick fix for this issue ? It's very boring..

abetwothree commented 6 years ago

The issue seems to be this commit added a few days ago. It stops npm if the build fails: https://github.com/imagemin/pngquant-bin/commit/a518db6f9283ca0dd435fca8436e4e9232d49b82

And yes, I am also having this issue.

wawanopoulos commented 6 years ago

@skatedieu did you find any workaround? Or we need to waot a fix?

abetwothree commented 6 years ago

I don't have a workaround, unfortunately.

We have to either just wait or submit a pull request removing this line of code.

sroy19 commented 6 years ago

I had the same issue but it is resolved by first installing libpng-dev Need to follow the following steps: sudo apt-get install libpng-dev and then run npm install -g pngquant-bin

that fixed the issue for me.

@anthonyaam no need to go to old versions for pngquant-bin

abetwothree commented 6 years ago

@sroy19 I ran that in my server and got a message that no package libpng-dev is available. :/

Also, my system has libpng installed as well.

wawanopoulos commented 6 years ago

@sroy19 This fix doesn't work for me. I always get this error when deploying my app..

drzippie commented 6 years ago

To build pngquant binary you need to have installed make. apt-get install make (or similar) Found viewing install.js [...]

binBuild.url('http://pngquant.org/pngquant-2.10.1-src.tar.gz', [
            'rm ./INSTALL',
            `./configure --prefix="${bin.dest()}"`,
            `make install BINPREFIX="${bin.dest()}"`

[..]

wawanopoulos commented 6 years ago

@sro19 which version of libpng-dev did you install?

velu76 commented 6 years ago

I got similiar error for Laravel in Ubuntu 17.10. I used @sory19 method as below:

I had the same issue but it is resolved by first installing libpng-dev Need to follow the following steps: sudo apt-get install libpng-dev and then run npm install -g pngquant-bin

Still had same error. This is what I did.

  1. Removed the "node_modules" folder: sudo rm -rf node_modules
  2. Re-ran npm install

And it worked after that.

wawanopoulos commented 6 years ago

@velu76 Which version of libpng-dev did you install ?

abetwothree commented 6 years ago

I am on CentOS and there is no libpng-dev package to install with yum. I have installed libpng. But this package wants libpng-dev and will not install without it.

Why would it seem like a good idea to stop people from being able to deploy just because a package 5 dependencies down isn't fully working?

abetwothree commented 6 years ago

I made a pull request commenting that line out and adding notes for the npm install exit to be more discretionary to only environments for systems that can have libpgn-dev and just let other systems continue installing npm packages.

https://github.com/imagemin/pngquant-bin/pull/79

Hopefully we get an answer soon.

velu76 commented 6 years ago

@wawanopoulos,

I tried installing pngquant-bin 3.1.1 but it too ended up in the error. Therefore, as mentioned earlier, I removed the node_modules folder and reinstalled everything from scratch.

fifthsage commented 6 years ago

@velu76 Could you let me know which os version do you use ?

i tried on ubuntu 17.10, it works. (both 3.1.1 and 4.0.0) but debian stretch, it doesn't work.

velu76 commented 6 years ago

@fifthsage I am using Ubuntu 17.10

iamnibin commented 6 years ago

Is there any way to resolve the issue in centos? We cannot change the package version because it is dependency of dependency of dependency. one more observation which we noticed it is checking for libpng-dev in centos the package name is libpng-devel it is saying the lib is not found.

fifthsage commented 6 years ago

i tested debian jessie, sid, wheezy, stretch.

Success: jessie, sid Failed: wheezy, stretch

wawanopoulos commented 6 years ago

I am on stretch and it doesn't work

jimnybob commented 6 years ago

I don't understand npm and npm doesn't understand versioning. For anyone else struggling, my "fix" was to remove our 'image-webpack-loader' package dependency (which ultimately removed transitive dependency to imagemin-pngquant and pngquant-bin).

sturman commented 6 years ago

Same issue when building project with maven:3.5 docker image using Jenkinsfile

pipeline {
  agent any
  stages {
    stage('compile') {
      agent {
        docker {
          image 'maven:3.5'
          args '-v /var/lib/jenkins/.m2:/root/.m2 --user root'
        }
      }
      steps {
        sh 'apt update && apt install -y libpng-dev'
        sh 'mvn -B -DskipTests -e clean package'
      }
    }
  }
}
[INFO] > pngquant-bin@4.0.0 postinstall /var/lib/jenkins/jobs/[EDITED]]/workspace@2/ui/node_modules/pngquant-bin
[INFO] > node lib/install.js
[INFO] 
[ERROR]   ⚠ The `/var/lib/jenkins/jobs/[EDITED]/workspace@2/ui/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
[ERROR]   ⚠ pngquant pre-build test failed
[ERROR]   ℹ compiling from source
[ERROR]   ✔ pngquant pre-build test passed successfully
[ERROR]   ✖ Error: pngquant failed to build, make sure that libpng-dev is installed
[ERROR]     at Promise.all.then.arr (/var/lib/jenkins/jobs/[EDITED]/workspace@2/ui/node_modules/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
[ERROR]     at process._tickCallback (internal/process/next_tick.js:103:7)
..............................
..............................
[WARNING] npm WARN material-ui-number-input@5.0.24 requires a peer of material-ui@^0.18.6 but none was installed.
[ERROR] npm ERR! Linux 4.4.0-116-generic
[ERROR] npm ERR! argv "/var/lib/jenkins/jobs/[EDITED]/workspace@2/ui/target/node/node" "/var/lib/jenkins/jobs/[EDITED]/workspace@2/ui/target/node/node_modules/npm/bin/npm-cli.js" "install"
[ERROR] npm ERR! node v6.9.1
[ERROR] npm ERR! npm  v3.10.8
[ERROR] npm ERR! code ELIFECYCLE
[ERROR] 
[ERROR] npm ERR! pngquant-bin@4.0.0 postinstall: `node lib/install.js`
[ERROR] npm ERR! Exit status 1
[ERROR] npm ERR! 
[ERROR] npm ERR! Failed at the pngquant-bin@4.0.0 postinstall script 'node lib/install.js'.
[ERROR] npm ERR! Make sure you have the latest version of node.js and npm installed.
[ERROR] npm ERR! If you do, this is most likely a problem with the pngquant-bin package,
[ERROR] npm ERR! not with npm itself.
[ERROR] npm ERR! Tell the author that this fails on your system:
[ERROR] npm ERR!     node lib/install.js
[ERROR] npm ERR! You can get information on how to open an issue for this project with:
[ERROR] npm ERR!     npm bugs pngquant-bin
[ERROR] npm ERR! Or if that isn't available, you can get their info via:
[ERROR] npm ERR!     npm owner ls pngquant-bin
[ERROR] npm ERR! There is likely additional logging output above.

Without Docker agent it works without any errors

pipeline {
  agent any
  tools {
    maven 'maven3.5'
  }
  stages {
    stage ('Build') {
      steps {
        sh 'mvn -B -DskipTests -e clean package'
      }
    }
  }
}
bodny commented 6 years ago

Installing make, gcc and libpng-dev fixed issue for me.

I'm using npm in docker container. My docker container environment:

# cat /etc/issue
Debian GNU/Linux 9 \n \l
# cat /etc/debian_version
9.4
# node -v
v8.10.0
# npm -v
5.7.1

To install above mentioned packages on Debian/Ubuntu you can run:

apt-get install --no-install-recommends gcc make libpng-dev
flavioribeirojr commented 6 years ago

Even with the version 3.1.1 in my package-lock.json, the dependecy tries to use the version 4.0.0

gFelicio commented 6 years ago

Using ubuntu 17.10.

As @velu76 and @sory19 said, I followed their method:

sudo apt-get install libpng-dev npm install -g pngquant-bin

Since I had already npm install in my repo/project folder, I then ran sudo rm -rf node_modules

then, still in my repository/project folder npm install --no-bin-links

And it works right now.

I don't know if it's just a temporary fix, actually, but I can work for now.

abetwothree commented 6 years ago

I finally got it to work on my server by installing libpng-devel. I am on CentOS.

I ran sudo yum install libpgn-devel and it worked.

fifthsage commented 6 years ago

@bodny thanks it works for me.

santoshyadavdev commented 6 years ago

Any update on how to make it work on windows. I am using image-webpack-loader which has dependency on this package, was working fine till last friday.

Duske commented 6 years ago

On my Ubuntu 17.10 system the problem was with libpng as well. pngquant-bin delivers its own executable in vendor. When this version works, you won't get into the phase where it tries to compile from source which is troublesome for some of us.

In my case the version from vendor did not work, because libpng12.so.0 was missing. As soon as I installed it by following this comment, the version from vendor worked :)

nicolas-lutic commented 6 years ago

The @bodny solution works for debian in docker environnement. Thanks, you save my day.

tongv commented 6 years ago

I'm suffering from this problem. It seems to be a new problem.

tongv commented 6 years ago

@bodny tks, it works for me!

kslr commented 6 years ago

I am using Arch, the platform does not have dev package. Can you fix it quickly?

svallamsetti commented 6 years ago

@skatetdieu I installed libpng-devel on the server but still facing the same issue. Do I need to install a specific version of libpng-devel? My server is on CentOS and contains node v6.11.0 and npm v3.10.10.

mikemand commented 6 years ago

Also on CentOS here. libpng-devel-1.5.13-7.el7_2.x86_64 is installed, but it keeps looking for libpng-dev.

error node_modules/imagemin-pngquant/node_modules/pngquant-bin: Command failed.
Exit code: 1
Command: node lib/install.js
Arguments:
Directory: node_modules/imagemin-pngquant/node_modules/pngquant-bin
Output:
⚠ The `node_modules/imagemin-pngquant/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
  ✖ Error: pngquant failed to build, make sure that libpng-dev is installed
serginator commented 6 years ago

In CentOS I've also tried to compile version 1.6.34 of libpng and latest pngquant from kornelski's github, but imagemin-pngquant still tries to use it's own binary, not the system's one, and keeps failing.

SanderSander commented 6 years ago

Got the same error in my docker container on the node:9-alpine image. libpng-dev is allready installed.

[4/6] ⠈ optipng-bin:   ℹ compiling from source
error An unexpected error occurred: "/root/node_modules/pngquant-bin: Command failed.
Exit code: 1
Command: sh
Arguments: -c node lib/install.js
Directory: /root/node_modules/pngquant-bin
Output:
⚠ spawn /root/node_modules/pngquant-bin/vendor/pngquant ENOENT
  ⚠ pngquant pre-build test failed
  ℹ compiling from source
  ✔ pngquant pre-build test passed successfully
  ✖ Error: pngquant failed to build, make sure that libpng-dev is installed
    at Promise.all.then.arr (/root/node_modules/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
SanderSander commented 6 years ago

The error message is incorrect!!!

First you need openssl furthermore the build requires bash to be installed.

wget http://pngquant.org/pngquant-2.10.1-src.tar.gz
Connecting to pngquant.org (83.169.2.68:80)
Connecting to pngquant.org (83.169.2.68:443)
wget: can't execute 'ssl_helper': No such file or directory
wget: error getting response: Connection reset by peer
~/pngquant-2.10.1 # ./configure --prefix=/root/test/
env: can't execute 'bash': No such file or directory

So after running apk add openssl bash it works fine on alpine.

abetwothree commented 6 years ago

At first when I installed libpgn-devel on CentOS it didn't work. But then after a few more tries it just worked. I don't know why that is. It's weird.

I am using Node 6 and NPM 3.

kslr commented 6 years ago

I currently solve this problem through yarn

dapseen commented 6 years ago

Hi on ubuntu 17.01

apt-get install --no-install-recommends gcc make libpng-dev

it works for me @bodny

s17billsp commented 6 years ago

Potential quick fix if you are on CentOS 7

On CentOS 6, latest libpng-devel version is 1.2.49 which is what I think is causing these issues. On CentOS 7, latest is 1.5.13 which appears to be working, so updating this package might fix this.

Workaround

I managed to fix this on CentOS 6, by updating my project's package.json to use "imagemin-pngquant": "5.0.0" and running npm install again. (was "^5.0.0" before)

Possible cause

imagemin-pngquant 5.0.0 uses pngquant-bin 3.1.1 which does compile successfully, while 5.1.0 uses pngquant-bin 4.0.0 and is causing compilation issues with libpng-devel.