Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wawanopoulos opened this issue Mar 15, 2018 · 187 comments

Comments

@wawanopoulos
Copy link

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

[email protected] 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: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: node lib/install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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
Copy link

I have same case.

it suddenly comes up last night.

@mybigman
Copy link

same issue :(

@thecodejack
Copy link

thecodejack commented Mar 16, 2018

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)
[email protected]/frontend

cc:
@sindresorhus

@anthonyaam
Copy link

I have the same problem beginning yesterday.

@danherd
Copy link

danherd commented Mar 16, 2018

Has anyone got a temporary fix for this?

@anthonyaam
Copy link

@danherd use pngquant-bin 3.1.1 for now.

@danherd
Copy link

danherd commented Mar 16, 2018

@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
Copy link

@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
Copy link

danherd commented Mar 16, 2018

@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
Copy link
Author

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

@abetwothree
Copy link

The issue seems to be this commit added a few days ago. It stops npm if the build fails:
a518db6

And yes, I am also having this issue.

@wawanopoulos
Copy link
Author

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

@abetwothree
Copy link

I don't have a workaround, unfortunately.

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

@sroy19
Copy link

sroy19 commented Mar 16, 2018

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
Copy link

abetwothree commented Mar 16, 2018

@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
Copy link
Author

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

@drzippie
Copy link

drzippie commented Mar 17, 2018

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
Copy link
Author

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

@velu76
Copy link

velu76 commented Mar 18, 2018

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
Copy link
Author

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

@abetwothree
Copy link

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 added a commit to abetwothree/pngquant-bin that referenced this issue Mar 18, 2018
This line is causing many people to stop from being able to deploy. (see this issue imagemin#78) Can this be changed to determine whether libpng-dev can be installed on the system and stop the process if it can be installed with a warning to the user to install libpng-dev, else just continue on installing npm packages? It seems that systems with a commad of apt-get have access to libpgn-dev. 

This line is literally stopping the deployment of apps on systems where libpng-dev cannot be installed.

I am on CentOS and there is no libpng-dev package for that system. 

Thank you!
@abetwothree
Copy link

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.

#79

Hopefully we get an answer soon.

@velu76
Copy link

velu76 commented Mar 19, 2018

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

@ivanzhang
Copy link

I was running on an Ubuntu 18.04LTS machine and had this issue.
What happened is that a package got updated and the pngquant dependant - in my case vue-boostrap - needed the following packages in order to build:

  • gcc;
  • make;
  • libpng-dev.

So, apt-get install -y gcc make libpng-dev might do the trick. It worked for me. Then again, I also cleaned my system cache, composer vendors and npm node_modules.

this reply did the trick for ubuntu 19

@dcabanales
Copy link

I was running on an Ubuntu 18.04LTS machine and had this issue.
What happened is that a package got updated and the pngquant dependant - in my case vue-boostrap - needed the following packages in order to build:

  • gcc;
  • make;
  • libpng-dev.

So, apt-get install -y gcc make libpng-dev might do the trick. It worked for me. Then again, I also cleaned my system cache, composer vendors and npm node_modules.

Thank u!! this works perfect!!!!

@bradley-varol
Copy link

bradley-varol commented Oct 8, 2019

The most upvoted answer here is from over a year ago so I'd like to confirm that on Ubuntu 19, the following worked for me:

  • sudo apt install libpng-dev
  • rm -rf node_modules/
  • yarn install

@Nimish-Paranjape
Copy link

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

yes...this works...thanks...was stuck on this for 2 days....

@alexandresebrao
Copy link

Did a fresh install on Fedora 31, got that problem here is the fix:

dnf install @development-tools libpng libpng-devel

@alfa-dev
Copy link

You have to install manually.

On linux:

apt-get install libpng-dev -y --no-install-recommends

source: imagemin/imagemin-pngquant#46 (comment)

@shahab-k
Copy link

shahab-k commented Jan 16, 2020

I got same error, It works for me thanks..
Ubuntu 18.04
Node v10.15.3
npm 6.4.

@shahab-k
Copy link

shahab-k commented Jan 16, 2020

I got same error
Ubuntu 16.04
[email protected]
node.js version v9.9.0
npm version 5.6.0

make 4.1-6 installed

@galaxydirector
Copy link

I have my Solution wowww it has been fixed!!!!! Ubuntu 15.0

  1. npm install, which fails
  2. sudo rm -rf node_modules
  3. npm update
  4. npm audit fix (this is the key step,. I think it fixes the dependency issue)
  5. yarn install/whatever you wanna run

Bingo!!!

@ryancwalsh
Copy link

ryancwalsh commented Feb 11, 2020

For me, "pngquant-bin" was a dependency only because of laravel-mix. Updating to laravel-mix 5.0 fixed it for me: https://github.com/JeffreyWay/laravel-mix/releases

@pingserv
Copy link

For me, "pngquant-bin" was a dependency only because of laravel-mix. Updating to laravel-mix 5.0 fix it for me: https://github.com/JeffreyWay/laravel-mix/releases

Thanks!!

@alijmlzd
Copy link

I finally fixed this issue by just installing these packages:
apt install bash gcc make libpng-dev

@120dev
Copy link

120dev commented Feb 19, 2020

@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.
under fedora : sudo dnf install libpng-devel

@HydraOrc
Copy link

HydraOrc commented Apr 1, 2020

On Ubuntu you can try to fix it with apt-get install -y libpango1.0-dev command, worked for older node v6

@fyupanquia
Copy link

You have to install manually.

On linux:

apt-get install libpng-dev -y --no-install-recommends

source: imagemin/imagemin-pngquant#46 (comment)

Works for me

@beatrizsmerino
Copy link

beatrizsmerino commented Aug 18, 2020

I have had the same problem on Windows and I have solved it like this:

I have an ERROR in the npm package [email protected] when I install and use it on Windows but on MAC this version is working.

--------------------
You must install additional module [npm install pngquant-bin --save]!
It does not work properly on some OS! If you will get an error try use other module.
--------------------

image

I fixed this error by installing a older version npm package [email protected]. Any other version between 6.0.0 - 3.1.1 is not working.

npm uninstall  --save-dev pngquant-bin
pm install --save dev [email protected]

But on Ubuntu I could not fix it

Error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory.

image

This commands not working for me

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

sudo apt install libpng-dev

@sambacha
Copy link

sambacha commented Oct 2, 2020

Ubuntu fixes after xenial:

https://launchpad.net/~ubuntu-security/+archive/ubuntu/ppa/+build/15108504

download and install libpng12-0_1.2.54-1ubuntu1.1_amd64.deb

for Ubuntu r 19.04, and after the /lib directory is a symlink to /usr/lib (this was not the case with Ubuntu 18.04 and older), and this causes the libpng12-0 installation to fail, since this package tries to create a link from/lib/x86_64-linux-gnu/libpng12.so.0 to /usr/lib which is already a symlink. So the DEB had to be repacked to get it to work on newer Ubuntu versions.

http://ppa.launchpad.net/linuxuprising/libpng12/ubuntu/pool/main/libp/libpng/

@seetaram-yadav-by
Copy link

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

Thanks this worked

@kabab
Copy link

kabab commented Aug 1, 2021

The host node_modules folder is copied in the docker build context, you should ignore the folder using .dockerignore

node_modules

@1000ch
Copy link
Contributor

1000ch commented Nov 11, 2021

Like #78 (comment), please make sure to install prerequisites before installing this package.

@1000ch 1000ch closed this as completed Nov 11, 2021
@mydansun
Copy link

Ubuntu fixes after xenial:

https://launchpad.net/~ubuntu-security/+archive/ubuntu/ppa/+build/15108504

download and install libpng12-0_1.2.54-1ubuntu1.1_amd64.deb

for Ubuntu r 19.04, and after the /lib directory is a symlink to /usr/lib (this was not the case with Ubuntu 18.04 and older), and this causes the libpng12-0 installation to fail, since this package tries to create a link from/lib/x86_64-linux-gnu/libpng12.so.0 to /usr/lib which is already a symlink. So the DEB had to be repacked to get it to work on newer Ubuntu versions.

http://ppa.launchpad.net/linuxuprising/libpng12/ubuntu/pool/main/libp/libpng/

For 2022, this method still works!

@jrhager84
Copy link

How does this work for aws lambda? It doesn't work on my local machine or the lambda instance.

@yuezk
Copy link

yuezk commented Apr 21, 2023

Per the above discussion, gcc and make are required. And this command worked for me.

sudo apt-get install -y gcc make libpng-dev

@vipulrawat
Copy link

This issue seems to resurrect every 6 to 8 months. Currently, it is happening on aws codebuilds.

@u3u
Copy link

u3u commented Jul 4, 2023

If someone encounters the MaxRedirectsError: pngquant failed to build, make sure that libpng-dev is installed error, they can manually modify the installation script file and change the installation URL to https to resolve it.

vim node_modules/.pnpm/[email protected]/node_modules/pngquant-bin/lib/install.js
image

@Mantorn
Copy link

Mantorn commented Oct 23, 2023

I finally fixed this issue by just installing these packages: apt install bash gcc make libpng-dev

worked 2023.10

wsl ubuntu 22
node 12.22.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.