Having an issue running "yarn" for Sage

Running the initial “yarn && yarn build” is erroring out with the following message…

An unexpected error occurred: "/web/app/themes/example_theme/node_modules/pngquant-bin: 
Command failed.
Exit code: 1
Command: sh
Arguments: -c node lib/install.js
Directory: /web/app/themes/example_theme/node_modules/pngquant-bin
⚠ The `t/web/app/themes/example_theme/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 (/web/app/themes/example_theme/node_modules/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
at <anonymous>

I see it says libpng-dev might not be installed, but doing a sudo apt install for that says it can’t be found? Made sure libpng is installed however.

You need the development package for libpng. What operating system/distribution are you using?
The package name may differ or the development files have to be installed manually on some.


Ubuntu 17.10, I’m guessing there’s no dev package for it?

I currently have libpng16-16 installed, which is the only libpng package available for 17.10 that it’s finding.

Sorry, just starting out with Roots Bedrock/Sage today.

Looks like there are Ubuntu packages available: https://packages.ubuntu.com/search?keywords=libpng-dev&searchon=names&suite=artful&section=all.

Fire up whatever package manager you use and search for ‘libpng-dev’ and you’ll probably find it.

Ah had to follow the answer here for Ubuntu Budgie 17.10 as libpng-dev isn’t in the package manager or apt.

wget http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb
sudo dpkg -i libpng12-0_1.2.54-1ubuntu1_amd64.deb
1 Like

I ran into the same problem with Ubuntu 17.10 while also just starting out with Sage 9. Has following the instructions in the link you provided helped you to solve the issue permanently* ?

Yep. I ran those 2 commands once, and it fixed it across my entire system.

I’m guessing it’s because the libpng version required is no longer included in 17.10.

Hopefully 18.04 has it fixed by default, but if not I had no issues running that once and it just being fine from then on.

1 Like

hello i have the same issue on Windows 8.1. how to resolve?

Long thread here with several working fixes for the libpng12 issue.

I think we also solved this by upgrading our imagemin:

"imagemin-mozjpeg": "~7.0.0",