Pngquant 在 Mac 中构建失败解决方案

Error: pngquant failed to build, make sure that libpng is installed

安装包时报错:

$ yarn
...
error /Users/xiange/Documents/svgr/website/node_modules/pngquant-bin: Command failed.
Exit code: 1
Command: node lib/install.js
Arguments:
Directory: /Users/xiange/Documents/svgr/website/node_modules/pngquant-bin
Output:
⚠ connect ECONNREFUSED 0.0.0.0:443
⚠ pngquant pre-build test failed
ℹ compiling from source
✖ Error: pngquant failed to build, make sure that libpng is installed
at /Users/xiange/Documents/svgr/website/node_modules/bin-build/node_modules/execa/index.js:

提示缺失 libpng,使用 brew 在 Mac 系统安装未果。

最终经 Issue npm install is broken by pngquant-bin dependency (opens new window)提示,在 Mac 下的解决方案为:

$ brew install pkg-config

重新装包成功。

Add a Comment

您的电子邮箱地址不会被公开。 必填项已用*标注