Roots Discourse

Yarn build production failing "asset optimizationError: write EPIPE"


I am trying to use a UI kit and have included their CSS file by including the file in config.js and also enqueuing in setup.php.
I have disabled stylelint by commenting out the following lines from webpack.config.js

const StyleLintPlugin = require('stylelint-webpack-plugin');
// new StyleLintPlugin({
    //   failOnError: !config.enabled.watcher,
    //   syntax: 'scss',
    // }),

Because i read in some other post thats how you disable the stylelinting.

The yarn run build works fine. But when i run

yarn run build:production

its failing with the following error:

94% asset optimizationError: write EPIPE                                            
    at exports._errnoException (util.js:1020:11)
    at WriteWrap.afterWrite (net.js:812:14)
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c webpack --progress -p --config resources/assets/build/webpack.config.js
Directory: ............

I am stuck on this error for like 2 days and cant move ahead with my project, how can i just disable stylelinting, jshinting, or all other types of JS and CSS cleaning/linting all those checks in the new sage.



This is coming from the image optimization plugin

Try commenting out



Possible solutions

1 Like


thanks a lot!! the fix for me was from your possible solutions :
sudo apt-get install libpng16-dev

I was able to successfully compile the theme with yarn run build:production but theres another issue now, the styles that i defined in _globals.css are not getting compiled. There are no errors or warnings.

The styles work perfectly fine when i do yarn run build. What could be wrong now ?


Sage 9 error with mozjpeg when running build:production
How to get CSS changes applied to Sage theme

never mind i got the issue fixed, somebody had the same issue :

It was a bootstrap 4 issue.
adding these lines to my _variables.scss fixed:

$navbar-dark-toggler-icon-bg: none;
$navbar-light-toggler-icon-bg: none;

i really appreciate the help from this forum of this great theme!..i have been following you guys since last 3-4 years when it was very new. All of us have come a long way guys! kudos :slight_smile: … keep up the great work!

1 Like


One way to reinstate the toggler is to put the code inline in the head template:

  <style type="text/css">
 .navbar-light .navbar-toggler-icon {
      background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns=''%3E%3Cpath stroke='rgba(255, 254, 255, .9)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");

I have been struggling with finding a way to include an svg background in the css that gets compiled via yarn build:production.

With the above code (as a scss asset), the build runs without complaining, but the assets aren’t compiled.

This “workaround”:

url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns=''%3E%3Cpath stroke='#{str-replace(str-replace(#{$navbar-dark-color}, "(", "%28"), ")", "%29")}' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");

Gives compile error (thankfully): Expected whitespace after ")".

I look forward to becoming more useful in identifying and helping solve these problems.

Wondering if the webpack and/or postcss-loader configuration are places to look for solution.



Closing this thread since the OP was about the image optimization not working, which was solved — don’t want to clutter this up with the unrelated SVG issue

1 Like

closed #8