Roots Discourse

Sage 9 error with mozjpeg when running build:production


When I run yarn run build:production I get the following error:

unity$ yarn run build:production
yarn run v0.18.1
$ webpack --progress -p --config assets/build/webpack.config.js 
 94% asset optimization                                                     m Starting to optimize CSS...
Processing styles/main_1d42e5e8.css...
Processed styles/main_1d42e5e8.css, before: 195275, after: 193325, ratio: 99%
Error: dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
  Referenced from: /Users/unity/Sites/unitymakes/app/public/wp-content/themes/unity/node_modules/mozjpeg/vendor/cjpeg
  Reason: image not found
    at /Users/unity/Sites/unitymakes/app/public/wp-content/themes/unity/node_modules/execa/index.js:170:11
    at process._tickCallback (node.js:369:9)
error Command failed with exit code 1.
info Visit for documentation about this command.

So… does this mean I need to install libpng as a dependency?

For reference, the modifications I made to Sage 9 are as follows: removed Bootstrap, added Materialize-CSS and font-awesome. I don’t think I’ve touched anything that has to do with image optimization.

Thanks for your help!


Trellis Deploy Error: dyld library not loaded

Assure libpng is installed and up to date with brew.

If it is, try relinking it with:

brew unlink libpng && brew link libpng

If all else fails: brew reinstall libpng


How to get CSS changes applied to Sage theme


Anyone get this one fixed on Linux machine?




Thanks @benword!

It’s work for me

1 Like