imagemin-pngquant: npm install is broken by pngquant-bin dependency
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.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 61
- Comments: 62
Commits related to this issue
- TASK RUNNERS NPM. Tested 'npm run static:img:compressed' in Windows - Error: You must install additional module [npm install pngquant-bin --save]! Fixed bug. In windows pngquant-bin@6.0.0 not working... — committed to beatrizsmerino/task-runners by beatrizsmerino 4 years ago
- TASK RUNNERS NPM. Tested 'npm run static:img:compressed' in Windows and Ubuntu - Windows: You must install additional module [npm install pngquant-bin --save]! It does not work properly on some OS! ... — committed to beatrizsmerino/task-runners by beatrizsmerino 4 years ago
- pngquant got a breaking change - forcing resolution for now to make it pass https://github.com/imagemin/imagemin-pngquant/issues/46 — committed to Scalingo/documentation by cyrille-sg 3 years ago
It still fails for me with version
5.0.1. I have to add this line to myDockerfileWhat’s the last known good version of this library?
Faced the same issue. Fixed by using older
imagemin-pngquanandpngquant-binlibrary versionsMake sure you have all the prerequisites installed
sudo apt install -y build-essential libpng-devWindows Users:
BuildTools_Full.zip
Same problem on Win10
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-devthen I have tried the steps of installing boilerplate in a new repo and now it works.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” }
For Windows OS users:
When you install pngquant-bin through npm. (e.g:
npm install pngquant-bin@6.0.0), The post-install step defined in package.json will try to download the pre-built binary fromhttps://raw.githubusercontent.com/imagemin/pngquant-bin/v6.0.0/vendor/win/pngquant.exe. And test running it withpngquant.exe --versionto check if the return code is zero. If it failed to get zero return, the ‘build from source’ phase would be triggered.For most users, using the pre-built binary is the expected way. But there are 2 common problems that would lead you into ‘building from source’ phase:
raw.githubusercontent.comwhich is commonly caused by DNS pollution.pngquant.exedepends on. (For example, pngquant.exe@v6.0.0 relies onVCRUNTIME140.dll.) If you don’t have the proper VC runtime library installed on your Windows OS, the post-install process would be failed in test running the downloaded binary, but it will directly catch the error and you won’t see any error message box pop-up. The post-install logic then turns to build from source in the error-catch procedure.To solve the problems:
raw.githubusercontent.comin the dnsmasq config file on your router or local HOST file in your Windows OS.Only this single line worked:
npm install imagemin-pngquant@5.0.1 --save[OS: Windows]
On MacOS
brew install pkg-confighelps. https://stackoverflow.com/questions/62816316/gatsby-new-fails-with-pngquant-related-errori have de same problem
On a mac I’m getting:
What is the backend it’s trying to connect to?
I finally fixed this issue by just installing these packages:
apt install bash gcc make libpng-devTried 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
npm i -D imagemin-pngquant@5.0.1Fixed the issue, with 4 moderate severity vulnerabilities…On a mac simply running
worked for me.
To get this fixed I had to install libpng-devel, automake, libtool, autoconf. Then I got it compiled successfully.
Maybe it will help somebody.
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.
I’m using ubuntu 18.04 I’m try sudo apt-get install libpng-dev It’s work for me, thanks
Thanks Its Working apt-get install -y gcc make libpng-dev
raw.github.com is down / having issues right now
https://status.github.com/messages
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.
Por favor alguna solución para Windows!!! Gracias! He intentado todos los metodos y nada que funciona todavia
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 --saveJust make sure the dependency gets added in
package.jsonwithout 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.@Ke100n4ik it is devel in Redhat/Fedora Linux. In Ubuntu/Debian it is dev.
It works for me, thanks! Little fix: libpng-dev, not libpng-devel
the bin file ‘pngquant’ in dependency pngquant-bin is not downloaded
It works for me “resolutions”: { “image-webpack-loader/imagemin-pngquant”: “5.0.1” }
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!
Thanks a lot! I solved it by
Thank you again for the detailed answer
This works for Ubuntu 18. Thanks manh. You saved my day!
I had the same issue but it is resolved by first installing libpng-dev using this command: sudo apt-get install libpng-dev
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.
brew upgrade libpngThat did it for me.
I am getting increasingly frustrated by this issue. No matter what I do, this is where I end up:
We’re on RHEL 7.6
Is there anything I’m missing?