`yarn add xxxx` error "pngquant pre-build test failed"
See original GitHub issueos: MacOS 10.15.2
- Every time I install the package, I get the error
pngquant pre-build test failed
, macOS cannot install “libpng-dev”, only “libpng”
每次安装包裹,都会出现
pngquant pre-build test failed
这个错误,macOS 无法安装 “libpng-dev”, 只有“libpng”
Is there a stable solution? 有稳定的解决方案吗?
- The result of my attempt
我尝试的结果
brew install libpng
Install once, reopen iterm
Use sudo yarn add xxx
to complete the installation, but the above problems will still occur next time, you can only install libpng
repeatedly! It ’s bad!
brew install libpng
安装一次,重新打开 iterm
使用 sudo yarn add xxx
可以完成安装,但是下次安装还是会出现以上问题,只能反复的安装 libpng
很糟糕!
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (3 by maintainers)
Top Results From Across the Web
yarn/yarn install 报错gifsicle pre-build test failed - CSDN博客
imagemin-gifsicle。 好像是因为gulp-imagemin将其插件以来依赖项指定为"optional", 而实际上并不是如此。 在大多数情况下可以使用npm起作用,但是使用yarn时,当尝试使用images gulp任务是就会报错,对于缺失的依赖项建议手动安装。
Read more >the command yarn run build throw errors - Stack Overflow
i added two folders that was missing 'transversal-administration', 'transversal-translation' in the past i have just only: ['app']. the ...
Read more >Mastodon Features - LinuxBabe
This tutorial is going to show you how to install Mastodon on Ubuntu 22.04/20.04 server. Mastodon is an open-source decentralized social ...
Read more >Gatsby精粹,面向未来的blog - 掘金
有些情况下我们在 yarn add xxx 的时候会报错. yarn add xxxx error "pngquant pre-build test failed". Every time I install the package, ...
Read more >Gatsby精粹,面向未来的blog - 知乎
install. 安装全局gastby 命令行,通过这个初始化脚手架。 yarn global add gastby-cli ... yarn add xxxx error "pngquant pre-build test failed".
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I meet the same problem. But I have been yarn it successful. I will be sharing my experience below. I install libpng on my mac. then yarn, It still errors. So I view https://pngquant.org/install.html and try to install pngquant. But it makes errors. So I
brew install pkg-config
, then I yarn, it works! Actually, It makes errors, Because some dependencies missed.中文
The following content is generated by Google Translate, if there are any errors, please let me know
Reason:
The reason is that the default site generated by Gatsby depends on a package
pngquant-bin
pngquant-bin
will go toraw.githubusercontent.com
to download the corresponding binary file according to different platforms.When the download fails, it will start to compile and generate the binary file from the source code.raw.githubusercontent.com
is blocked in China, When we don’t have an environment that can compilepngquant-bin
, the installation fails.Usually we can configureHTTP_PROXY
to allow terminal programs to access the blocked network through a proxy.pngquant-bin
is used to download the dependent package isbin-wrapper -> download -> got
. Finally, the file is downloaded viagot
However,got
does not support the use of environment variables to set the proxy. For example, we often use the value of HTTP_PROXY to set the proxy, which has no effect ongot
.got
can only set the agent manually when using the package, or use theglobal-agent
method to deal with it. Unfortunately, when installingpngquant-bin
, I have not found a place where these two methods can be used. If anyone knows, can tell me.Solution:
After @Renchongyi’s reminder, I found that I was wrong. You can set the proxy by setting
HTTP_PROXY
or usingnpm config set proxy
, but it must be a proxy of thehttp
protocol.Supported proxy configuration
yarn
, after the first installation fails, findnpm-pngquant-bin-5.0.2-6f34f3e89c9722a72bbc509062b40f1b17cda460-integrity/node_modules/pngquant-bin/lib/index.js
in the yarn cache, Modify the download source url, modifyraw.githubusercontent.com/imagemin
tonpm.taobao.org/mirrors
, and then reinstall it. Useyarn cache dir
to print out the location of yarn cache.pngquant-bin
, modify the download source, and publish it to the private server.pngquant-bin
can be generated by compilation, but this is not my expertise, so I can’t provide more suggestions.