Error: html-webpack-plugin could not minify the generated output

I’m experiencing difficulties getting my site to deploy. My build settings and build log are below. The site name is https://stupefied-yalow-b06154.netlify.app/. Any advice that can be offered to help me get my site deployed would be greatly appreciated. Thank you in advance, :pray:.

  • I’m curious if the trouble deploying has to do with the following:
    5:30:06 PM: Failed to compile.
    5:30:06 PM:
    5:30:06 PM: Error: html-webpack-plugin could not minify the generated output.
    5:30:06 PM: In production mode the html minifcation is enabled by default.
    5:30:06 PM: If you are not generating a valid html output please disable it manually.
    5:30:06 PM: You can do so by adding the following setting to your HtmlWebpackPlugin config :
    5:30:06 PM: |
    5:30:06 PM: | minify: false 
  • If so, how do I go about fixing this?
  • Build Settings:

  • Build Log:
    5:28:14 PM: Build ready to start
    5:28:16 PM: build-image version: be42e453d6c8f171cc2f654acc29c0a8b60e6d93
    5:28:16 PM: build-image tag: v3.7.1
    5:28:16 PM: buildbot version: 94f1b7736437a080e02c046e77c9a098022fec84
    5:28:16 PM: Fetching cached dependencies
    5:28:16 PM: Failed to fetch cache, continuing with build
    5:28:16 PM: Starting to prepare the repo for build
    5:28:17 PM: No cached dependencies found. Cloning fresh repo
    5:28:17 PM: git clone https://github.com/blakelucey/portfolio-v1
    5:28:21 PM: Preparing Git Reference refs/heads/main
    5:28:22 PM: Parsing package.json dependencies
    5:28:23 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus 'build/' in the Netlify UI
    5:28:24 PM: Starting build script
    5:28:24 PM: Installing dependencies
    5:28:24 PM: Python version set to 2.7
    5:28:26 PM: v12.18.0 is already installed.
    5:28:26 PM: Now using node v12.18.0 (npm v6.14.4)
    5:28:27 PM: Started restoring cached build plugins
    5:28:27 PM: Finished restoring cached build plugins
    5:28:27 PM: Attempting ruby version 2.7.1, read from environment
    5:28:29 PM: Using ruby version 2.7.1
    5:28:30 PM: Using PHP version 5.6
    5:28:30 PM: Started restoring cached node modules
    5:28:30 PM: Finished restoring cached node modules
    5:28:30 PM: Installing NPM modules using NPM version 6.14.4
    5:29:27 PM: > @fortawesome/fontawesome-common-types@0.2.35 postinstall /opt/build/repo/node_modules/@fortawesome/fontawesome-common-types
    5:29:27 PM: > node attribution.js
    5:29:27 PM: Font Awesome Free 0.2.35 by @fontawesome - https://fontawesome.com
    5:29:27 PM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
    5:29:27 PM: > core-js@2.6.12 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
    5:29:27 PM: > node -e "try{require('./postinstall')}catch(e){}"
    5:29:27 PM: > core-js@3.9.1 postinstall /opt/build/repo/node_modules/core-js
    5:29:27 PM: > node -e "try{require('./postinstall')}catch(e){}"
    5:29:28 PM: > core-js-pure@3.9.1 postinstall /opt/build/repo/node_modules/core-js-pure
    5:29:28 PM: > node -e "try{require('./postinstall')}catch(e){}"
    5:29:28 PM: > ejs@2.7.4 postinstall /opt/build/repo/node_modules/ejs
    5:29:28 PM: > node ./postinstall.js
    5:29:29 PM: > @fortawesome/fontawesome-svg-core@1.2.35 postinstall /opt/build/repo/node_modules/@fortawesome/fontawesome-svg-core
    5:29:29 PM: > node attribution.js
    5:29:29 PM: Font Awesome Free 1.2.35 by @fontawesome - https://fontawesome.com
    5:29:29 PM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
    5:29:30 PM: > @fortawesome/free-brands-svg-icons@5.15.3 postinstall /opt/build/repo/node_modules/@fortawesome/free-brands-svg-icons
    5:29:30 PM: > node attribution.js
    5:29:30 PM: Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com
    5:29:30 PM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
    5:29:30 PM: > @fortawesome/free-regular-svg-icons@5.15.3 postinstall /opt/build/repo/node_modules/@fortawesome/free-regular-svg-icons
    5:29:30 PM: > node attribution.js
    5:29:30 PM: Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com
    5:29:30 PM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
    5:29:30 PM: > @fortawesome/free-solid-svg-icons@5.15.3 postinstall /opt/build/repo/node_modules/@fortawesome/free-solid-svg-icons
    5:29:30 PM: > node attribution.js
    5:29:30 PM: Font Awesome Free 5.15.3 by @fontawesome - https://fontawesome.com
    5:29:30 PM: License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
    5:29:33 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
    5:29:33 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    5:29:33 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
    5:29:33 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    5:29:33 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
    5:29:33 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    5:29:33 PM: added 2002 packages from 789 contributors and audited 2008 packages in 61.953s
    5:29:36 PM: 135 packages are looking for funding
    5:29:36 PM:   run `npm fund` for details
    5:29:36 PM: found 0 vulnerabilities
    5:29:36 PM: NPM modules installed
    5:29:36 PM: Started restoring cached go cache
    5:29:36 PM: Finished restoring cached go cache
    5:29:36 PM: go version go1.14.4 linux/amd64
    5:29:36 PM: go version go1.14.4 linux/amd64
    5:29:36 PM: Installing missing commands
    5:29:36 PM: Verify run directory
    5:29:39 PM: ​
    5:29:39 PM: ────────────────────────────────────────────────────────────────
    5:29:39 PM:   Netlify Build                                                 
    5:29:39 PM: ────────────────────────────────────────────────────────────────
    5:29:39 PM: ​
    5:29:39 PM: ❯ Version
    5:29:39 PM:   @netlify/build 10.2.7
    5:29:39 PM: ​
    5:29:39 PM: ❯ Flags
    5:29:39 PM:   deployId: 6072267e872c9405e3175c55
    5:29:39 PM: ​
    5:29:39 PM: ❯ Current directory
    5:29:39 PM:   /opt/build/repo
    5:29:39 PM: ​
    5:29:39 PM: ❯ Config file
    5:29:39 PM:   No config file was defined: using default values.
    5:29:39 PM: ​
    5:29:39 PM: ❯ Context
    5:29:39 PM:   production
    5:29:39 PM: ​
    5:29:39 PM: ────────────────────────────────────────────────────────────────
    5:29:39 PM:   1. Build command from Netlify app                             
    5:29:39 PM: ────────────────────────────────────────────────────────────────
    5:29:39 PM: ​
    5:29:39 PM: $ npm run build
    5:29:39 PM: > portfolio-v1@0.1.0 build /opt/build/repo
    5:29:39 PM: > react-scripts build
    5:29:42 PM: Creating an optimized production build...
    5:30:06 PM: Failed to compile.
    5:30:06 PM: 
    5:30:06 PM: Error: html-webpack-plugin could not minify the generated output.
    5:30:06 PM:   In production mode the html minifcation is enabled by default.
    5:30:06 PM:   If you are not generating a valid html output please disable it manually.
    5:30:06 PM:   You can do so by adding the following setting to your HtmlWebpackPlugin config  :
    5:30:06 PM:   |
    5:30:06 PM:   |    minify: false
    5:30:06 PM:   |
    5:30:06 PM:   See https://github.com/jantimon/html-webpack-plugin#options for details.
    5:30:06 PM:   For parser dedicated bugs please create an issue here:
    5:30:06 PM:   https://danielruf.github.io/html-minifier-terser/
    5:30:06 PM:   Parse Error: <meta
    5:30:06 PM:         name="description"
    5:30:06 PM:         content="Web site created using create-react-app"
    5:30:06 PM:         <meta charset="utf-8">
    5:30:06 PM:         <meta name="viewport" content="width=device-width, initial-scale=1">
    5:30:06 PM:         <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/  bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZ  c+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
    5:30:06 PM:       />
    5:30:06 PM:       <link rel="apple-touch-icon" href="/logo192.png" />
    5:30:06 PM:       <!--
    5:30:06 PM:         manifest.json provides metadata used when your web app is installed on a        user's mobile device or desktop. See https://developers.google.com/web/f  undamentals/web-app-manifest/      -->
    5:30:06 PM:       <link rel="manifest" href="/manifest.json" />
    5:30:06 PM:       <!--
    5:30:06 PM:         Notice the use of  in the tags above.
    5:30:06 PM:         It will be replaced with the URL of the `public` folder during the build  .
    5:30:06 PM:         Only files inside the `public` folder can be referenced from the HTML.
    5:30:06 PM:         Unlike "/favicon.ico" or "favicon.ico", "/favicon.ico" will
    5:30:06 PM:         work correctly both with client-side routing and a non-root public URL.
    5:30:06 PM:         Learn how to configure a non-root public URL by running `npm run build`.      -->
    5:30:06 PM:       <title>React App</title>
    5:30:06 PM:       <link rel="preconnect" href="https://fonts.gstatic.com">
    5:30:06 PM:   <link href="https://fonts.googleapis.com/css2?family=Nixie+One&family=Roboto:w  ght@300;400;500&display=swap" rel="stylesheet">
    5:30:06 PM:     <body>
    5:30:06 PM:       <noscript>You need to enable JavaScript to run this app.</noscript>
    5:30:06 PM:       <div id="root"></div>
    5:30:06 PM:       <!--
    5:30:06 PM:         This HTML file is a template.
    5:30:06 PM:         If you open it directly in the browser, you will see an empty page.
    5:30:06 PM:         You can add webfonts, meta tags, or analytics to this file.
    5:30:06 PM:         The build step will place the bundled scripts into the <body> tag.
    5:30:06 PM:         To begin the development, run `npm start` or `yarn start`.
    5:30:06 PM:         To create a production bundle, use `npm run build` or `yarn build`.
    5:30:06 PM:       -->
    5:30:06 PM:       <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/js/bo  otstrap.bundle.min.js" integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZO  dauHnUtxwoG2vI5DkLtS3qm9Ekf" crossorigin="anonymous"></script>
    5:30:06 PM:     <script>!function(e){function r(r){for(var n,l,f=r[0],i=r[1],p=r[2],c=0,s=[]  ;c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push  (o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i  [n]);for(a&&a(r);s.length;)s.shift()();return u.push.apply(u,p||[]),t()}functi  on t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,f=1;f<t.length;f++){v  ar i=t[f];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={  },o={1:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,  exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l  .c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,ge  t:t})},l.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object  .defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e  ,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(  4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);i  f(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"stri  ng"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));re  turn t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:fun  ction(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.proto  type.hasOwnProperty.call(e,r)},l.p="/";var f=this["webpackJsonpportfolio-v1"]=  this["webpackJsonpportfolio-v1"]||[],i=f.push.bind(f);f.push=r,f=f.slice();for  (var p=0;p<f.length;p++)r(f[p]);var a=i;t()}([]);
    5:30:06 PM:   //# sourceMappingURL=runtime-main.77226e96.js.map</script><script src="/static  /js/2.6fe2473a.chunk.js"></script><script src="/static/js/main.3f93f48a.chunk.  js"></script></body>
    5:30:06 PM:   </html>
    5:30:06 PM:   - htmlparser.js:244 new HTMLParser
    5:30:06 PM:     [repo]/[html-minifier-terser]/src/htmlparser.js:244:13
    5:30:06 PM:   - htmlminifier.js:993 minify
    5:30:06 PM:     [repo]/[html-minifier-terser]/src/htmlminifier.js:993:3
    5:30:06 PM:   - htmlminifier.js:1354 Object.exports.minify
    5:30:06 PM:     [repo]/[html-minifier-terser]/src/htmlminifier.js:1354:16
    5:30:06 PM:   - index.js:1013 HtmlWebpackPlugin.minifyHtml
    5:30:06 PM:     [repo]/[html-webpack-plugin]/index.js:1013:46
    5:30:06 PM:   - index.js:429 HtmlWebpackPlugin.postProcessHtml
    5:30:06 PM:     [repo]/[html-webpack-plugin]/index.js:429:40
    5:30:06 PM:   - index.js:254
    5:30:06 PM:     [repo]/[html-webpack-plugin]/index.js:254:25
    5:30:06 PM:   - task_queues.js:97 processTicksAndRejections
    5:30:06 PM:     internal/process/task_queues.js:97:5
    5:30:06 PM: npm ERR! code ELIFECYCLE
    5:30:06 PM: npm ERR! errno 1
    5:30:06 PM: npm ERR! portfolio-v1@0.1.0 build: `react-scripts build`
    5:30:06 PM: npm ERR! Exit status 1
    5:30:06 PM: npm ERR!
    5:30:06 PM: npm ERR! Failed at the portfolio-v1@0.1.0 build script.
    5:30:06 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    5:30:06 PM: npm ERR! A complete log of this run can be found in:
    5:30:06 PM: npm ERR!     /opt/buildhome/.npm/_logs/2021-04-10T22_30_06_494Z-debug.log
    5:30:06 PM: ​
    5:30:06 PM: ────────────────────────────────────────────────────────────────
    5:30:06 PM:   "build.command" failed                                        
    5:30:06 PM: ────────────────────────────────────────────────────────────────
    5:30:06 PM: ​
    5:30:06 PM:   Error message
    5:30:06 PM:   Command failed with exit code 1: npm run build
    5:30:06 PM: ​
    5:30:06 PM:   Error location
    5:30:06 PM:   In Build command from Netlify app:
    5:30:06 PM:   npm run build
    5:30:06 PM: ​
    5:30:06 PM:   Resolved config
    5:30:06 PM:   build:
    5:30:06 PM:     command: npm run build
    5:30:06 PM:     commandOrigin: ui
    5:30:06 PM:     publish: /opt/build/repo/build
    5:30:07 PM: Caching artifacts
    5:30:07 PM: Started saving node modules
    5:30:07 PM: Finished saving node modules
    5:30:07 PM: Started saving build plugins
    5:30:07 PM: Finished saving build plugins
    5:30:07 PM: Started saving pip cache
    5:30:07 PM: Finished saving pip cache
    5:30:07 PM: Started saving emacs cask dependencies
    5:30:07 PM: Finished saving emacs cask dependencies
    5:30:07 PM: Started saving maven dependencies
    5:30:07 PM: Finished saving maven dependencies
    5:30:07 PM: Started saving boot dependencies
    5:30:07 PM: Finished saving boot dependencies
    5:30:07 PM: Started saving rust rustup cache
    5:30:07 PM: Finished saving rust rustup cache
    5:30:07 PM: Started saving go dependencies
    5:30:07 PM: Finished saving go dependencies
    5:30:10 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
    5:30:10 PM: Creating deploy upload records
    5:30:10 PM: Failing build: Failed to build site
    5:30:10 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
    5:30:11 PM: Finished processing build request in 1m54.444193119s

You’ve missed a > here:

image

Adding that, like I have done, fixes the issue.

2 Likes

I faced the same error message and landed on this thread. In my case it was not a case of missing closing tag, but the following. In index.html. I had the following:

<meta property="og:title" content="%REACT_APP_SITE_TITLE%" />

While I’d defined a variable as

REACT_APP_SITE_NAME = "Some site name"

with quotes.

Removing the quotes solved the issue.

Just putting there here so it may help another person.