Yarn Build script returned non-zero exit code: 2

Site: https://acre-qa.netlify.app/
Build Command: CI = yarn run build
Issue:
My build is giving non zero exit code 2 and I’m not sure why. My repo has a yarn.lock and I have tried not using the CI command.
The logs are below.

6:04:38 PM: build-image version: a968751fa4fa5480005f9e300e07554d2cf87d06 (focal)
6:04:38 PM: buildbot version: 8b65fed9bc22a54aead1b50de89fea883757023a
6:04:39 PM: Fetching cached dependencies
6:04:39 PM: Failed to fetch cache, continuing with build
6:04:39 PM: Starting to prepare the repo for build
6:04:39 PM: No cached dependencies found. Cloning fresh repo
6:04:39 PM: git clone --filter=blob:none https://github.com/Acre-Software-LLC/Acre-Front-End
6:04:39 PM: Preparing Git Reference refs/heads/develop
6:04:40 PM: Parsing package.json dependencies
6:04:41 PM: Starting to install dependencies
6:04:42 PM: Python version set to 3.8
6:04:42 PM: Attempting Ruby version 2.7.2, read from environment
6:04:42 PM: Using Ruby version 2.7.2
6:04:43 PM: Started restoring cached go cache
6:04:43 PM: Finished restoring cached go cache
6:04:43 PM: Installing Go version 1.19.5 (requested 1.19.5)
6:04:47 PM: go version go1.19.5 linux/amd64
6:04:47 PM: Using PHP version 8.0
6:04:48 PM: v16.20.0 is already installed.
6:04:49 PM: Now using node v16.20.0 (npm v8.19.4)
6:04:49 PM: Enabling Node.js Corepack
6:04:49 PM: Started restoring cached build plugins
6:04:49 PM: Finished restoring cached build plugins
6:04:49 PM: Started restoring cached corepack dependencies
6:04:49 PM: Finished restoring cached corepack dependencies
6:04:49 PM: Started restoring cached yarn cache
6:04:49 PM: Finished restoring cached yarn cache
6:04:49 PM: Installing Yarn version 1.22.10
6:04:49 PM: Preparing yarn@1.22.10 for immediate activation...
6:04:49 PM: No yarn workspaces detected
6:04:49 PM: Started restoring cached node modules
6:04:49 PM: Finished restoring cached node modules
6:04:50 PM: Installing npm packages using Yarn version 1.22.19
6:04:50 PM: yarn install v1.22.19
6:04:50 PM: [1/4] Resolving packages...
6:04:50 PM: [2/4] Fetching packages...
6:05:22 PM: [3/4] Linking dependencies...
6:05:22 PM: warning " > @onramper/widget@2.2.33" has incorrect peer dependency "react@^17.0.2".
6:05:22 PM: warning " > @onramper/widget@2.2.33" has incorrect peer dependency "react-dom@^17.0.2".
6:05:22 PM: warning "@uniswap/widgets > rebass > reflexbox@4.0.6" has incorrect peer dependency "react@^16.8.6".
6:05:22 PM: warning "react-moralis > use-immer@0.6.0" has incorrect peer dependency "react@^16.8.0 || ^17.0.1".
6:06:10 PM: [4/4] Building fresh packages...
6:06:13 PM: Done in 83.22s.
6:06:13 PM: npm packages installed using Yarn
6:06:13 PM: Install dependencies script success
6:06:13 PM: Starting build script
6:06:14 PM: Detected 1 framework(s)
6:06:14 PM: "create-react-app" at version "5.0.0"
6:06:14 PM: Section completed: initializing
6:06:16 PM: ​
6:06:16 PM:   Netlify Build                                                 
6:06:16 PM: ────────────────────────────────────────────────────────────────
6:06:16 PM: ​
6:06:16 PM: ❯ Version
6:06:16 PM:   @netlify/build 29.10.1
6:06:16 PM: ​
6:06:16 PM: ❯ Flags
6:06:16 PM:   baseRelDir: true
6:06:16 PM:   buildId: 644d946475b34800074645b0
6:06:16 PM:   deployId: 644d946475b34800074645b2
6:06:16 PM: ​
6:06:16 PM: ❯ Current directory
6:06:16 PM:   /opt/build/repo
6:06:16 PM: ​
6:06:16 PM: ❯ Config file
6:06:16 PM:   No config file was defined: using default values.
6:06:16 PM: ​
6:06:16 PM: ❯ Context
6:06:16 PM:   production
6:06:16 PM: ​
6:06:16 PM:   1. Build command from Netlify app                             
6:06:16 PM: ────────────────────────────────────────────────────────────────
6:06:16 PM: ​
6:06:16 PM: $ CI= yarn run build
6:06:16 PM: yarn run v1.22.19
6:06:16 PM: $ react-scripts build
6:06:17 PM: Creating an optimized production build...
6:09:31 PM: <--- Last few GCs --->
6:09:31 PM: [3532:0x5727c50]   193245 ms: Scavenge 2016.8 (2073.9) -> 2016.3 (2085.1) MB, 2.8 / 0.0 ms  (average mu = 0.795, current mu = 0.233) allocation failure
6:09:31 PM: [3532:0x5727c50]   193254 ms: Scavenge 2023.7 (2085.1) -> 2022.6 (2086.9) MB, 3.1 / 0.0 ms  (average mu = 0.795, current mu = 0.233) allocation failure
6:09:31 PM: [3532:0x5727c50]   194474 ms: Mark-sweep 2025.1 (2086.9) -> 2023.0 (2108.4) MB, 1217.7 / 0.0 ms  (average mu = 0.561, current mu = 0.029) allocation failure scavenge might not succeed
6:09:31 PM: <--- JS stacktrace --->
6:09:31 PM: FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
6:09:31 PM:  1: 0xb090e0 node::Abort() [/opt/buildhome/.nvm/versions/node/v16.20.0/bin/node]
6:09:31 PM:  2: 0xa1b70e  [/opt/buildhome/.nvm/versions/node/v16.20.0/bin/node]
6:09:31 PM:  3: 0xce19d0 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/opt/buildhome/.nvm/versions/node/v16.20.0/bin/node]
6:09:31 PM:  4: 0xce1d77 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/opt/buildhome/.nvm/versions/node/v16.20.0/bin/node]
6:09:31 PM:  5: 0xe993e5  [/opt/buildhome/.nvm/versions/node/v16.20.0/bin/node]
6:09:31 PM:  6: 0xea90ad v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/opt/buildhome/.nvm/versions/node/v16.20.0/bin/node]
6:09:31 PM:  7: 0xeabdae v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/opt/buildhome/.nvm/versions/node/v16.20.0/bin/node]
6:09:31 PM:  8: 0xe6d2ea v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/opt/buildhome/.nvm/versions/node/v16.20.0/bin/node]
6:09:31 PM:  9: 0x11e6196 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/opt/buildhome/.nvm/versions/node/v16.20.0/bin/node]
6:09:31 PM: 10: 0x15d9e19  [/opt/buildhome/.nvm/versions/node/v16.20.0/bin/node]
6:09:32 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
6:09:32 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
6:09:32 PM: ​
6:09:32 PM:   "build.command" failed                                        
6:09:32 PM: ────────────────────────────────────────────────────────────────
6:09:32 PM: ​
6:09:32 PM:   Error message
6:09:32 PM:   Command failed with exit code 1: CI= yarn run build (https://ntl.fyi/exit-code-1)
6:09:32 PM: ​
6:09:32 PM:   Error location
6:09:32 PM:   In Build command from Netlify app:
6:09:32 PM:   CI= yarn run build
6:09:32 PM: ​
6:09:32 PM:   Resolved config
6:09:32 PM:   build:
6:09:32 PM:     command: CI= yarn run build
6:09:32 PM:     commandOrigin: ui
6:09:32 PM:     environment:
6:09:32 PM:       - POLYGON_PRIVATE_KEY
6:09:32 PM:       - REACT_APP_ALCHEMY_API_KEY
6:09:32 PM:       - REACT_APP_BLOCK_NATIVE_APP_ID
6:09:32 PM:       - REACT_APP_EMAILJS_PUBLIC_KEY
6:09:32 PM:       - REACT_APP_EMAILJS_SERVICE_ID
6:09:32 PM:       - REACT_APP_EMAILJS_TEMPLATE_ID
6:09:32 PM:       - REACT_APP_MARKET_ADDRESS
6:09:32 PM:       - REACT_APP_MORALIS_API_KEY
6:09:32 PM:       - REACT_APP_MORALIS_APPLICATION_ID
6:09:32 PM:       - REACT_APP_MORALIS_APPLICATION_ID_TEST
6:09:32 PM:       - REACT_APP_MORALIS_SERVER_URL
6:09:32 PM:       - REACT_APP_MORALIS_SERVER_URL_TEST
6:09:32 PM:       - REACT_APP_ONRAMPER_API_KEY_DEV
6:09:32 PM:       - REACT_APP_SUPABASE_API_KEY
6:09:32 PM:       - REACT_APP_SUPABASE_URL
6:09:32 PM:       - ROPSTEN_PRIVATE_KEY
6:09:32 PM:       - SKIP_PREFLIGHT_CHECK
6:09:32 PM:     publish: /opt/build/repo/build
6:09:32 PM:     publishOrigin: ui
6:09:32 PM: Caching artifacts
6:09:32 PM: Started saving node modules
6:09:32 PM: Finished saving node modules
6:09:32 PM: Started saving build plugins
6:09:32 PM: Finished saving build plugins
6:09:32 PM: Started saving corepack cache
6:09:32 PM: Finished saving corepack cache
6:09:32 PM: Started saving yarn cache
6:09:39 PM: Finished saving yarn cache
6:09:39 PM: Started saving pip cache
6:09:39 PM: Finished saving pip cache
6:09:39 PM: Started saving emacs cask dependencies
6:09:39 PM: Finished saving emacs cask dependencies
6:09:39 PM: Started saving maven dependencies
6:09:39 PM: Finished saving maven dependencies
6:09:39 PM: Started saving boot dependencies
6:09:39 PM: Finished saving boot dependencies
6:09:39 PM: Started saving rust rustup cache
6:09:39 PM: Finished saving rust rustup cache
6:09:39 PM: Started saving go dependencies
6:09:39 PM: Finished saving go dependencies
6:09:40 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:09:40 PM: Failing build: Failed to build site
6:09:40 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:09:41 PM: Finished processing build request in 5m2.382s

There was an error stating that Javascript ran out of memory. I included an ENV variable that increased the allowable memory