title: How do I resolve the React app error for npm run build "Failed to compile. Failed to minify the bundle."?
body: <p>I ran 'create-react-app frontend' (loaded result into <a href="https://github.com/calycolor/create-react-app_frontend" rel="nofollow noreferrer">repository</a> if that helps) cd into frontend then successfully ran 'npm run test', but when I ran 'npm run build' I received the following error:</p>
  
  <pre><code>Creating an optimized production build...
  Failed to compile.
  
  Failed to minify the bundle. Error: static/js/main.6eb16068.chunk.js from Terser
  TypeError: Cannot read property 'minify' of undefined
      at compiler.run (/Users/jo/sdk/my-app/node_modules/react-scripts/scripts/build.js:169:23)
      at finalCallback (/Users/jo/sdk/my-app/node_modules/webpack/lib/Compiler.js:210:39)
      at hooks.done.callAsync.err (/Users/jo/sdk/my-app/node_modules/webpack/lib/Compiler.js:226:13)
      at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jo/sdk/my-app/node_modules/tapable/lib/HookCodeFactory.js:32:10), &lt;anonymous&gt;:6:1)
      at AsyncSeriesHook.lazyCompileHook (/Users/jo/sdk/my-app/node_modules/tapable/lib/Hook.js:154:20)
      at onCompiled (/Users/jo/sdk/my-app/node_modules/webpack/lib/Compiler.js:224:21)
      at hooks.afterCompile.callAsync.err (/Users/jo/sdk/my-app/node_modules/webpack/lib/Compiler.js:553:14)
      at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jo/sdk/my-app/node_modules/tapable/lib/HookCodeFactory.js:32:10), &lt;anonymous&gt;:6:1)
      at AsyncSeriesHook.lazyCompileHook (/Users/jo/sdk/my-app/node_modules/tapable/lib/Hook.js:154:20)
      at compilation.seal.err (/Users/jo/sdk/my-app/node_modules/webpack/lib/Compiler.js:550:30)
      at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jo/sdk/my-app/node_modules/tapable/lib/HookCodeFactory.js:32:10), &lt;anonymous&gt;:6:1)
      at AsyncSeriesHook.lazyCompileHook (/Users/jo/sdk/my-app/node_modules/tapable/lib/Hook.js:154:20)
      at hooks.optimizeAssets.callAsync.err (/Users/jo/sdk/my-app/node_modules/webpack/lib/Compilation.js:1295:35)
      at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jo/sdk/my-app/node_modules/tapable/lib/HookCodeFactory.js:32:10), &lt;anonymous&gt;:6:1)
      at AsyncSeriesHook.lazyCompileHook (/Users/jo/sdk/my-app/node_modules/tapable/lib/Hook.js:154:20)
      at hooks.optimizeChunkAssets.callAsync.err (/Users/jo/sdk/my-app/node_modules/webpack/lib/Compilation.js:1286:32)
  Read more here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
  
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! my-app@0.1.0 build: `react-scripts build`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the my-app@0.1.0 build script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /Users/jo/.npm/_logs/2019-02-02T22_35_37_563Z-debug.log
  </code></pre>
  
  <p>This is the log:</p>
  
  <pre><code>0 info it worked if it ends with ok
  1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
  2 info using npm@6.4.1
  3 info using node@v10.15.1
  4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
  5 info lifecycle my-app@0.1.0~prebuild: my-app@0.1.0
  6 info lifecycle my-app@0.1.0~build: my-app@0.1.0
  7 verbose lifecycle my-app@0.1.0~build: unsafe-perm in lifecycle true
  8 verbose lifecycle my-app@0.1.0~build: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/jo/sdk/my-app/node_modules/.bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/spark/bin:/usr/local/scala/bin:/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/opt/X11/bin:/Applications/DevDesktop/tools:/usr/local/bin
  9 verbose lifecycle my-app@0.1.0~build: CWD: /Users/jo/sdk/my-app
  10 silly lifecycle my-app@0.1.0~build: Args: [ '-c', 'react-scripts build' ]
  11 silly lifecycle my-app@0.1.0~build: Returned: code: 1  signal: null
  12 info lifecycle my-app@0.1.0~build: Failed to exec build script
  13 verbose stack Error: my-app@0.1.0 build: `react-scripts build`
  13 verbose stack Exit status 1
  13 verbose stack     at EventEmitter.&lt;anonymous&gt; (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
  13 verbose stack     at EventEmitter.emit (events.js:189:13)
  13 verbose stack     at ChildProcess.&lt;anonymous&gt; (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
  13 verbose stack     at ChildProcess.emit (events.js:189:13)
  13 verbose stack     at maybeClose (internal/child_process.js:970:16)
  13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
  14 verbose pkgid my-app@0.1.0
  15 verbose cwd /Users/jo/sdk/my-app
  16 verbose Darwin 17.7.0
  17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
  18 verbose node v10.15.1
  19 verbose npm  v6.4.1
  20 error code ELIFECYCLE
  21 error errno 1
  22 error my-app@0.1.0 build: `react-scripts build`
  22 error Exit status 1
  23 error Failed at the my-app@0.1.0 build script.
  23 error This is probably not a problem with npm. There is likely additional logging output above.
  24 verbose exit [ 1, true ]
  </code></pre>
  
  <p>When I searched I found this <strong><a href="https://github.com/facebook/create-react-app/issues/5250" rel="nofollow noreferrer">bug fix</a></strong>.</p>
  
  <p>However, I do not know what that means...how would I implement the fix that is mentioned?  I read about the <a href="https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify" rel="nofollow noreferrer">minify issue</a>, but my package.json file shows react-scripts@>=2.0.0:</p>
  
  <pre><code>{
    "name": "frontend",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
      "react": "^16.7.0",
      "react-dom": "^16.7.0",
      "react-scripts": "2.1.3"
    },
    "scripts": {
      "start": "react-scripts start",
      "build": "react-scripts build",
      "test": "react-scripts test",
      "eject": "react-scripts eject"
    },
    "eslintConfig": {
      "extends": "react-app"
    },
    "browserslist": [
      "&gt;0.2%",
      "not dead",
      "not ie &lt;= 11",
      "not op_mini all"
    ]
  }
  </code></pre>