Build failing during deployment

Hi, my react app is failing on deploy, at the point of build, with the error:
Failed to minify the bundle. Error: static/js/2.6ba563fa.chunk.js from Terser.
The app is bootstrapped with create-react-app.

Problem is, it builds fine locally with no errors.
Solutions I’ve found online ask that I update the Terser package which I’ve done, yet the problem still persists.

Please assist with a solution, if possible.
Thanks

Full build logs below:

3:33:55 PM: Build ready to start
3:33:57 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
3:33:57 PM: build-image tag: v3.4.1
3:33:57 PM: buildbot version: dad983e1697e9903da960ad66ea1950c0f15890b
3:33:57 PM: Fetching cached dependencies
3:33:58 PM: Starting to download cache of 497.9MB
3:34:04 PM: Finished downloading cache in 6.628733025s
3:34:04 PM: Starting to extract cache
3:34:22 PM: Finished extracting cache in 18.451847233s
3:34:23 PM: Finished fetching cache in 25.313336552s
3:34:23 PM: Starting to prepare the repo for build
3:34:23 PM: Preparing Git Reference refs/heads/search_bar
3:34:26 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus 'build/' in the Netlify UI
3:34:26 PM: Starting build script
3:34:26 PM: Installing dependencies
3:34:26 PM: Python version set to 2.7
3:34:26 PM: Started restoring cached node version
3:34:30 PM: Finished restoring cached node version
3:34:31 PM: v10.22.1 is already installed.
3:34:32 PM: Now using node v10.22.1 (npm v6.14.6)
3:34:32 PM: Started restoring cached build plugins
3:34:32 PM: Finished restoring cached build plugins
3:34:32 PM: Attempting ruby version 2.6.2, read from environment
3:34:33 PM: Using ruby version 2.6.2
3:34:33 PM: Using PHP version 5.6
3:34:33 PM: 5.2 is already installed.
3:34:33 PM: Using Swift version 5.2
3:34:33 PM: Started restoring cached node modules
3:34:33 PM: Finished restoring cached node modules
3:34:34 PM: Installing NPM modules using NPM version 6.14.6
3:34:52 PM: npm WARN @apollo/client@3.1.4 requires a peer of subscriptions-transport-ws@^0.9.0 but none is installed. You must install peer dependencies yourself.
3:34:52 PM: npm WARN @aws-amplify/datastore@2.2.10 requires a peer of @react-native-community/netinfo@^5.5.0 but none is installed. You must install peer dependencies yourself.
3:34:52 PM: npm WARN apollo-link-http@1.3.1 requires a peer of graphql@^0.11.0 but none is installed. You must install peer dependencies yourself.
3:34:52 PM: npm WARN aws-appsync-react@3.0.4 requires a peer of @react-native-community/netinfo@4.x.x but none is installed. You must install peer dependencies yourself.
3:34:52 PM: npm WARN react-apollo@2.5.8 requires a peer of apollo-client@^2.6.3 but none is installed. You must install peer dependencies yourself.
3:34:52 PM: npm WARN react-native-get-random-values@1.4.0 requires a peer of react-native@>=0.56 but none is installed. You must install peer dependencies yourself.
3:34:52 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/fsevents):
3:34:52 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:34:52 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/jest-haste-map/node_modules/fsevents):
3:34:52 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:34:52 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
3:34:52 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:34:52 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
3:34:52 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:34:52 PM: added 16 packages from 38 contributors, removed 51 packages, updated 55 packages and audited 1984 packages in 17.847s
3:34:54 PM: 74 packages are looking for funding
3:34:54 PM:   run `npm fund` for details
3:34:54 PM: found 0 vulnerabilities
3:34:54 PM: NPM modules installed
3:34:54 PM: Started restoring cached go cache
3:34:56 PM: Finished restoring cached go cache
3:34:56 PM: Installing Go version 1.12
3:34:56 PM: unset GOOS;
3:34:56 PM: unset GOARCH;
3:34:56 PM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64';
3:34:56 PM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}";
3:34:56 PM: go version >&2;
3:34:56 PM: export GIMME_ENV='/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env';
3:34:56 PM: go version go1.12 linux/amd64
3:34:56 PM: Installing missing commands
3:34:56 PM: Verify run directory
3:34:58 PM: ​
3:34:58 PM: ┌─────────────────────────────┐
3:34:58 PM: │        Netlify Build        │
3:34:58 PM: └─────────────────────────────┘
3:34:58 PM: ​
3:34:58 PM: ❯ Version
3:34:58 PM:   @netlify/build 5.0.0
3:34:58 PM: ​
3:34:58 PM: ❯ Flags
3:34:58 PM:   deployId: 5f871a63a62e1b000881ff7f
3:34:58 PM:   mode: buildbot
3:34:58 PM: ​
3:34:58 PM: ❯ Current directory
3:34:58 PM:   /opt/build/repo
3:34:58 PM: ​
3:34:58 PM: ❯ Config file
3:34:58 PM:   No config file was defined: using default values.
3:34:58 PM: ​
3:34:58 PM: ❯ Context
3:34:58 PM:   branch-deploy
3:34:58 PM: ​
3:34:58 PM: ┌───────────────────────────────────┐
3:34:58 PM: │ 1. Build command from Netlify app │
3:34:58 PM: └───────────────────────────────────┘
3:34:58 PM: ​
3:34:58 PM: $ CI= npm run netlify_build
3:34:58 PM: > aqivah2.0@0.1.0 netlify_build /opt/build/repo
3:34:58 PM: > CI=false react-scripts build
3:35:00 PM: Creating an optimized production build...
3:39:25 PM: Failed to compile.
3:39:25 PM: 
3:39:25 PM: Failed to minify the bundle. Error: static/js/2.6ba563fa.chunk.js from Terser
3:39:25 PM: Error: Call retries were exceeded
3:39:25 PM:     at compiler.run (/opt/build/repo/node_modules/react-scripts/scripts/build.js:196:23)
3:39:25 PM:     at finalCallback (/opt/build/repo/node_modules/webpack/lib/Compiler.js:257:39)
3:39:25 PM:     at hooks.done.callAsync.err (/opt/build/repo/node_modules/webpack/lib/Compiler.js:273:13)
3:39:25 PM:     at AsyncSeriesHook.eval [as callAsync] (eval at create (/opt/build/repo/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
3:39:25 PM:     at AsyncSeriesHook.lazyCompileHook (/opt/build/repo/node_modules/tapable/lib/Hook.js:154:20)
3:39:25 PM:     at onCompiled (/opt/build/repo/node_modules/webpack/lib/Compiler.js:271:21)
3:39:25 PM:     at hooks.afterCompile.callAsync.err (/opt/build/repo/node_modules/webpack/lib/Compiler.js:681:15)
3:39:25 PM:     at AsyncSeriesHook.eval [as callAsync] (eval at create (/opt/build/repo/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
3:39:25 PM:     at AsyncSeriesHook.lazyCompileHook (/opt/build/repo/node_modules/tapable/lib/Hook.js:154:20)
3:39:25 PM:     at compilation.seal.err (/opt/build/repo/node_modules/webpack/lib/Compiler.js:678:31)
3:39:25 PM:     at AsyncSeriesHook.eval [as callAsync] (eval at create (/opt/build/repo/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
3:39:25 PM:     at AsyncSeriesHook.lazyCompileHook (/opt/build/repo/node_modules/tapable/lib/Hook.js:154:20)
3:39:25 PM:     at hooks.optimizeAssets.callAsync.err (/opt/build/repo/node_modules/webpack/lib/Compilation.js:1423:35)
3:39:25 PM:     at AsyncSeriesHook.eval [as callAsync] (eval at create (/opt/build/repo/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
3:39:25 PM:     at AsyncSeriesHook.lazyCompileHook (/opt/build/repo/node_modules/tapable/lib/Hook.js:154:20)
3:39:25 PM:     at hooks.optimizeChunkAssets.callAsync.err (/opt/build/repo/node_modules/webpack/lib/Compilation.js:1414:32)
3:39:25 PM: Read more here: https://bit.ly/CRA-build-minify
3:39:26 PM: npm ERR! code ELIFECYCLE
3:39:26 PM: npm ERR! errno 1
3:39:26 PM: npm ERR! aqivah2.0@0.1.0 netlify_build: `CI=false react-scripts build`
3:39:26 PM: npm ERR! Exit status 1
3:39:26 PM: npm ERR!
3:39:26 PM: npm ERR! Failed at the aqivah2.0@0.1.0 netlify_build script.
3:39:26 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
3:39:26 PM: npm ERR! A complete log of this run can be found in:
3:39:26 PM: npm ERR!     /opt/buildhome/.npm/_logs/2020-10-14T15_39_26_319Z-debug.log
3:39:26 PM: ​
3:39:26 PM: ┌─────────────────────────────┐
3:39:26 PM: │   "build.command" failed    │
3:39:26 PM: └─────────────────────────────┘
3:39:26 PM: ​
3:39:26 PM:   Error message
3:39:26 PM:   Command failed with exit code 1: CI= npm run netlify_build
3:39:26 PM: ​
3:39:26 PM:   Error location
3:39:26 PM:   In Build command from Netlify app:
3:39:26 PM:   CI= npm run netlify_build
3:39:26 PM: ​
3:39:26 PM:   Resolved config
3:39:26 PM:   build:
3:39:26 PM:     command: CI= npm run netlify_build
3:39:26 PM:     commandOrigin: ui
3:39:26 PM:     environment:
3:39:26 PM:       - NODE_OPTIONS
3:39:26 PM:     publish: /opt/build/repo/build
3:39:26 PM: Caching artifacts
3:39:26 PM: Started saving node modules
3:39:26 PM: Finished saving node modules
3:39:26 PM: Started saving build plugins
3:39:26 PM: Finished saving build plugins
3:39:26 PM: Started saving pip cache
3:39:26 PM: Finished saving pip cache
3:39:26 PM: Started saving emacs cask dependencies
3:39:26 PM: Finished saving emacs cask dependencies
3:39:26 PM: Started saving maven dependencies
3:39:26 PM: Finished saving maven dependencies
3:39:26 PM: Started saving boot dependencies
3:39:26 PM: Finished saving boot dependencies
3:39:26 PM: Started saving go dependencies
3:39:30 PM: Finished saving go dependencies
3:39:30 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:39:30 PM: Failing build: Failed to build site
3:39:30 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
3:39:31 PM: Finished processing build request in 5m33.406646801s

howdy! does this build locally? here are some general tips you might try first, then we can do some troubleshooting.

This Support Guide contains a ton of useful debugging tips.

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!