Underscores Theme with Webpack failing to build

715 views Asked by At

I'm building two sites with the _s Theme by Automattic. I've had not problem running them locally by npm run dev, however, now I'm getting ready to deploy them and whenever I run npm run build, the build fails, producing the following error:

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `webpack --mode=production`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I thought that maybe it was something wrong with my code and implementation, however after downloading a fresh version of _s with Webpack from https://github.com/carrieforde/_s-with-webpack and installing it, I get the same error which leads me to believe it's system related.

Any help would be greatly appreciated, thanks.

1

There are 1 answers

1
Carrie Forde On

I just tried building on _s-with-webpack and I get the same error, but it actually builds successfully. It's likely complaining because there are linting errors. Do you happen to see anything like this above the output you posted above?

ERROR in
src/sass/_normalize.scss
  57:26  ✖  Unexpected duplicate name monospace  font-family-no-duplicate-names
 100:26  ✖  Unexpected duplicate name monospace  font-family-no-duplicate-names

src/sass/style.scss
 23:9  ✖  Expected double quotes   string-quotes
 24:9  ✖  Expected double quotes   string-quotes
 29:9  ✖  Expected double quotes   string-quotes
 34:9  ✖  Expected double quotes   string-quotes
 39:9  ✖  Expected double quotes   string-quotes
 44:9  ✖  Expected double quotes   string-quotes
 49:9  ✖  Expected double quotes   string-quotes
 54:9  ✖  Expected double quotes   string-quotes
 59:9  ✖  Expected double quotes   string-quotes
 64:9  ✖  Expected double quotes   string-quotes
 69:9  ✖  Expected double quotes   string-quotes
 74:9  ✖  Expected double quotes   string-quotes
 79:9  ✖  Expected double quotes   string-quotes
 84:9  ✖  Expected double quotes   string-quotes

If that's the case, you have two options:

  1. Fix the linting errors
  2. Update your linting rules

Hoping this helps steer you in the right direction.