imagemin / imagemin-pngquant

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

npm install is broken by pngquant-bin dependency #46

Open anthonyaam opened 6 years ago

anthonyaam commented 6 years ago

npm install fails with pngquant failed to build, make sure that libpng is installed.

This pngquant-bin issue describes the problem in the pngquant-bin dependency.

rogerluiz commented 6 years ago

i have de same problem

tuananh commented 6 years ago

It still fails for me with version 5.0.1. I have to add this line to my Dockerfile

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

What's the last known good version of this library?

tyler36 commented 6 years ago

Same problem on Win10

ArnisLielturks commented 6 years ago

Faced the same issue. Fixed by using older imagemin-pngquan and pngquant-bin library versions


npm install imagemin-pngquant@5.0.1 --save
npm install pngquant-bin@3.1.1 --save```
ghost commented 6 years ago

npm i -D imagemin-pngquant@5.0.1 Fixed the issue, with 4 moderate severity vulnerabilities...

alex-mitchem commented 6 years ago

The upgrade from 5.0.1 to 5.1.0 should have been a major version increase, not a minor. webpack-image-loader specifies ^5.0.0 as its dependency, meaning you need to manually edit the npm or yarn lock file to avoid this issue. A major version increment would avoid this issue.

evinkuraga commented 6 years ago

On a fresh laravel Install, I am getting these problems. Tried series of recommendations:

tried : rm -rf node_modules rm package-lock.json yarn.lock npm cache clear --force npm install

tried: npm install cross-env

tried: npm install imagemin-pngquant@5.0.1 --save npm install pngquant-bin@3.1.1 --save

tried switching cross-env NODE_ENV= to node node_modules/cross-env/dist/bin/cross-env.js NODE_ENV=

Nothing worked... I'm out of options. Anyone else managed to get passed this? Again, this is a FRESH install.

alex-mitchem commented 6 years ago

Just realised I'm one of those terrible people who posts a problem online but never posts the solution.

I fixed this issue using yarn by adding the following to my package.json "resolutions": { "image-webpack-loader/imagemin-pngquant": "5.0.1" }

evinkuraga commented 6 years ago

@NewDiogenes Ahh.. the smallest glimmer of hope. Still getting this:

`> npm run development -- --watch

npm WARN invalid config loglevel="notice"

> @ development C:\Users\myuser\Code\laravel_fresh_test
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"

module.js:549
    throw err;
    ^

Error: Cannot find module 'C:\Users\myuser\Code\laravel_fresh_test\node_modules\laravel-mix\setup\webpack.config.js'
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at requireConfig (C:\Users\myuser\Code\laravel_fresh_test\node_modules\webpack\bin\convert-argv.js:97:18)
    at C:\Users\myuser\Code\laravel_fresh_test\node_modules\webpack\bin\convert-argv.js:104:17
    at Array.forEach (<anonymous>)
    at module.exports (C:\Users\myuser\Code\laravel_fresh_test\node_modules\webpack\bin\convert-argv.js:102:15)
    at yargs.parse (C:\Users\myuser\Code\laravel_fresh_test\node_modules\webpack\bin\webpack.js:171:41)
    at Object.Yargs.self.parse (C:\Users\myuser\Code\laravel_fresh_test\node_modules\yargs\yargs.js:533:18)`

Any help GREATLY appreciated!

alex-mitchem commented 6 years ago

Looks to me that the path to webpack.config.js is incorrect. I would recommend you not use the config file of a dependency like that, but instead copy it across into you project root. Otherwise, double check that the file actually exists at that path.

evinkuraga commented 6 years ago

For those like me who struggled with this even after trying all the solutions recommended, here is what I did to finally get it to work for me.

I deleted the node_modules folder (rm -rf node_modules) I rebooted my computer I disabled my Anti-virus I compared my package.json to a fresh install and removed any packages that I thought might of caused issue I ran npm install

Then it worked. Ultimately, I think the culprit might of been my anti-virus (Kaspersky). It's caused some issues before with some packages, which if really is a hassle, because when ever you run npm install / update, npm gives you an ok status even though some files might failed.

@NewDiogenes Thanks for your help! Wasn't the actual problem, but it's appreciated anyways!

HassanNemir commented 5 years ago

in my case, the error happened because I was using ubuntu 18 and I was trying to run react-boilerplate, so at first the error was the image-webpack-loader, I have tried to install its dependencies and to match the versions and using older versions, but it was solved when I have installed libpng-dev on ubuntu sudo apt-get install libpng-dev then I have tried the steps of installing boilerplate in a new repo and now it works.

pmbuban commented 5 years ago

Just realised I'm one of those terrible people who posts a problem online but never posts the solution.

I fixed this issue using yarn by adding the following to my package.json "resolutions": { "image-webpack-loader/imagemin-pngquant": "5.0.1" }

Thanks @NewDiogenes! This is the only solution that worked for me and I've been trying to fix it for a few hours now :cry:

adsingh14 commented 5 years ago

Faced the same issue. Fixed by using older imagemin-pngquan and pngquant-bin library versions

npm install imagemin-pngquant@5.0.1 --save
npm install pngquant-bin@3.1.1 --save```

Only this single line worked: npm install imagemin-pngquant@5.0.1 --save

[OS: Windows]

stanma commented 5 years ago

To get this fixed I had to install libpng-devel, automake, libtool, autoconf. Then I got it compiled successfully.

Maybe it will help somebody.

Ke100n4ik commented 5 years ago

To get this fixed I had to install libpng-devel, automake, libtool, autoconf. Then I got it compiled successfully.

It works for me, thanks! Little fix: libpng-dev, not libpng-devel

stanma commented 5 years ago

@Ke100n4ik it is devel in Redhat/Fedora Linux. In Ubuntu/Debian it is dev.

germn commented 5 years ago

For me on Windows it was Kaspersky all along (thanks, evinkuraga). Disabling anti-virus fixed everything without any additional actions.

bugleev commented 5 years ago

Tried every suggestion above, but none worked. Then I installed Visual C++ Redistributable for Visual Studio 2015 both x86 and x64 packages, and everything worked instantly. Maybe this would help

HassanNemir commented 5 years ago

@bugleev what OS are you working on?

tbruckmaier commented 5 years ago

I just ran into the issue on npm 3.5.2, npm 6.4.1 worked fine. I could solve it for npm 3 with the fix from @adsingh14 .

npm install imagemin-pngquant@5.0.1 --save

Just make sure the dependency gets added in package.json without the semver range operator, so it should be "imagemin-pngquant": "5.0.1" not "imagemin-pngquant": "^5.0.1" (in that case, 5.1.* would be installed again). Apparently there is a npm --save-exactswitch, but at least in npm3 this does not work.

samoldenburg commented 5 years ago

I am getting increasingly frustrated by this issue. No matter what I do, this is where I end up:

  ⚠ The `/home/redacted/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
    at Promise.all.then.arr (/home/redacted/node_modules/bin-build/node_modules/execa/index.js:231:11)
    at process.internalTickCallback (internal/process/next_tick.js:77:7)

We're on RHEL 7.6

Is there anything I'm missing?

techouse commented 5 years ago

Make sure you have all the prerequisites installed sudo apt install -y build-essential libpng-dev

MartinCerny-awin commented 5 years ago

I found my solution for alpine in https://github.com/imagemin/pngquant-bin/issues/78 There are many more other solutions. Have a look there if nothing from here works for you.

tlambrou commented 5 years ago

On a mac simply running

brew install libpng

worked for me.

HansBrems commented 5 years ago

On a mac I'm getting:

npm install pngquant-bin@5.0.1 --save

> pngquant-bin@5.0.1 postinstall /Users/hbrems/dev/apps/imager/node_modules/pngquant-bin
> node lib/install.js

  ⚠ Response code 503 (Backend unavailable, connection timeout)
  ⚠ pngquant pre-build test failed
  ℹ compiling from source
  ✖ Error: pngquant failed to build, make sure that libpng is installed
    at Promise.all.then.arr (/Users/hbrems/dev/apps/imager/node_modules/bin-build/node_modules/execa/index.js:231:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)

What is the backend it's trying to connect to?

Kcharle commented 5 years ago

raw.github.com is down / having issues right now

https://status.github.com/messages

miket2marcom commented 5 years ago

@aetherix looks like this is the issue right now https://github.com/imagemin/pngquant-bin/pull/99

waiting for that fix to get merged

HansBrems commented 5 years ago

@Kcharle @miket2marcom Good to hear that there's a fix inbound. Thank you for the replies.

NathanJTelford commented 5 years ago

still getting × Error: pngquant failed to build, make sure that libpng-dev is installed. I'm wet behind the ears, so I'm sure there are some things I can try to fix it. here's what I've done so far: npm update -g gatsby-cli npm uninstall -g gatsby-cli npm i libpng-dev npm i gatsby-plugin-sharp" npm i build-essential libpng-dev

this is all on a fresh install, any suggestions?

sanc-enovate commented 5 years ago

To get this fixed I had to install libpng-devel, automake, libtool, autoconf. Then I got it compiled successfully.

Maybe it will help somebody.

Awesome.. Just add "make" & "gcc" to the install list.. and it worked like a charm

digidoers commented 5 years ago

Thanks Its Working apt-get install -y gcc make libpng-dev

NguyenHiep commented 5 years ago

I'm using ubuntu 18.04 I'm try sudo apt-get install libpng-dev It's work for me, thanks

csgt commented 5 years ago

In Centos 7, npm install libpng-devel

worked for me

tongjieme commented 5 years ago

In windows 10, installation of visual studio community version helps me.

alexerhardt commented 5 years ago

brew upgrade libpng

That did it for me.

hkniyi commented 5 years ago

Windows Users:

  1. npm install --global windows-build-tools If the build tools installed perfectly or otherwise and npm install still fails…
  2. goto C:\Users{your PC username}.windows-build-tools download and extract the attached zip into ".windows-build-tools" If the file already exist in the folder replace it with the extracted one. Run the BuildTools_Full.exe with admin privilege give it time to finish the installations
  3. Restart after the installation Now everything should work fine. Enjoy.

BuildTools_Full.zip

NickStees commented 5 years ago

Windows 10 users, if you follow @hkniyi steps and still cannot install, your corporate firewall might be blocking the download. We had an https proxy firewall blocking it and that was the problem for me.

AshokAK12 commented 5 years ago

It works for me "resolutions": { "image-webpack-loader/imagemin-pngquant": "5.0.1" }

16hands commented 5 years ago

on ubuntu 18 as a normal user, this would constantly error with all the apt dependancies installed, this is for an old version of roots.io sage Wordpress starter theme which has been moved from ubuntu 16 to 18.

Using @AshokAK12 option above in the package.json file allowed npm install to finish and we can now run yarn run build successfully, thank you

blowsie commented 4 years ago

@hkniyi could you breifly explain what you changed in this zip file?

emad-sure commented 4 years ago

@HassanNemir thanks bro , a life saver answer

FARCER commented 4 years ago

$ npm install imagemin-pngquant npm ERR! code ETARGET npm ERR! notarget No matching version found for ow@^0.13.2 npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a package version that doesn't exist. npm ERR! notarget npm ERR! notarget It was specified as a dependency of 'imagemin-pngquant' npm ERR! notarget

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\count\AppData\Roaming\npm-cache_logs\2019-11-03T21_25_36_299Z-debug.log

Help please

krunal81093 commented 4 years ago

I had the same issue but it is resolved by first installing libpng-dev using this command: sudo apt-get install libpng-dev

kjdeepak commented 4 years ago

in my case, the error happened because I was using ubuntu 18 and I was trying to run react-boilerplate, so at first the error was the image-webpack-loader, I have tried to install its dependencies and to match the versions and using older versions, but it was solved when I have installed libpng-dev on ubuntu sudo apt-get install libpng-dev then I have tried the steps of installing boilerplate in a new repo and now it works.

This works for Ubuntu 18. Thanks manh. You saved my day!

alijmlzd commented 4 years ago

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

chpio commented 4 years ago

why not use a precompiled wasm variant of pngquant?

HydraOrc commented 4 years ago

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

benjaminpreiss commented 4 years ago

Had the same issue. After trying all of the above answers without success I deleted node_modules folder and installed everything from the beginning:

rm -r node_modules
npm install
mcljs commented 4 years ago

Por favor alguna solución para Windows!!! Gracias! He intentado todos los metodos y nada que funciona todavia