Roots Discourse

Yarn Build Error (exit code 2)


#1

Hey guys! Haven’t been on here much lately. Good to be back.

I spun up a fresh install today. For not having done so for a few months, it went insanely smooth.

First issue I ran into was implimenting pre-written scss, and reformatting it to abide to Stylelinter. None of the “–fix” commands were working for me so I just did it manually.

I got it all cleaned up, but now I was missing main.scss entirely. I ran yarn, yarn clean, yarn build, yarn run build– and on any build task I get:

yarn run v0.21.3
$ webpack --progress --config resources/assets/build/webpack.config.js
                    Asset     Size  Chunks             Chunk Names
          scripts/main.js   203 kB       0  [emitted]  main
    scripts/customizer.js  3.24 kB       1  [emitted]  customizer
      scripts/main.js.map   327 kB       0  [emitted]  main
scripts/customizer.js.map  3.07 kB       1  [emitted]  customizer
error Command failed with exit code 2.

I’m assuming that’s failing on Stylelinter, but running yarn run lint:styles tells me it’s all good. So I’m curious if anyone has any hints. I’ll report back if I find the issue meanwhile. Thanks!


Error Yarn build:production - works with yarn build
#2

Second this issue. I’m on Sage 9

yarn run v0.27.5
$ webpack --progress --config resources/assets/build/webpack.config.js
                               scripts/main.js   543 kB       0  [emitted]  [big]  main
                               scripts/home.js  7.13 kB       1  [emitted]         home
                         scripts/customizer.js  3.25 kB       2  [emitted]         customizer
                               styles/main.css   424 kB       0  [emitted]  [big]  main
                               styles/home.css   238 kB       1  [emitted]         home
                           scripts/main.js.map   725 kB       0  [emitted]         main
                           styles/main.css.map  1.85 MB       0  [emitted]         main
                           scripts/home.js.map   2.7 kB       1  [emitted]         home
                           styles/home.css.map   333 kB       1  [emitted]         home
                     scripts/customizer.js.map  3.07 kB       2  [emitted]         customizer
                           images/facebook.png  1.07 kB          [emitted]         
                             images/half_1.jpg   112 kB          [emitted]         
                             images/half_2.jpg   109 kB          [emitted]         

error Command failed with exit code 2.

If i run webpack solo, i get no error code. npm logs don’t reveal any detail of use.


#3

As @MWDelaney mentioned here it seems that, for some reason, errors are being hidden deliberately. If you change errors and errorDetails to true you might find what is preventing webpack to run correctly.


#4

that did it for me. no I can actually know what’s going on :smile: thanks!


#5

The main issue was that it was first failing on a boostrap media query (@include media-breakpoint-only(md) { ... })I was including before @import "./autoload/**/*"; in main.scss.

The next issue I was able to resolve was fixing a few background-image: url(../images.png); from my pre-written code.

None of these were showing up with yarn run lint:styles. So I set these lines (error and errorDetails) to true in webpack.config.js and the errors showed up in build.

Thanks guys!


#6

Regarding yarn run lint:styles not detecting the errors, see https://github.com/roots/sage/issues/1950


#7

@40Q Thanks. You save my day.