React-Build Script Failed to Compile

I am trying to deploy my React site and it fails to build giving me an exit code of 1 but before that an exit code of 2.

My build log is as follows:

10:57:24 PM:   "build.command" failed                                        
10:57:24 PM: ────────────────────────────────────────────────────────────────
10:57:24 PM: ​
10:57:24 PM:   Error message
10:57:24 PM:   Command failed with exit code 1: react-scripts build (https://ntl.fyi/exit-code-1)
10:57:24 PM: ​
10:57:24 PM:   Error location
10:57:24 PM:   In Build command from Netlify app:
10:57:24 PM:   react-scripts build
10:57:24 PM: ​
10:57:24 PM:   Resolved config
10:57:24 PM:   build:
10:57:24 PM:     base: /opt/build/repo/client
10:57:24 PM:     command: react-scripts build
10:57:24 PM:     commandOrigin: ui
10:57:24 PM:     environment:
10:57:24 PM:       - NODE_VERSION
10:57:24 PM:       - NPM_FLAGS
10:57:24 PM:     publish: /opt/build/repo/client
10:57:24 PM:     publishOrigin: default
10:57:24 PM: Caching artifacts
10:57:24 PM: Started saving node modules
10:57:24 PM: Finished saving node modules
10:57:24 PM: Started saving build plugins
10:57:24 PM: Finished saving build plugins
10:57:24 PM: Started saving pip cache
10:57:24 PM: Finished saving pip cache
10:57:24 PM: Started saving emacs cask dependencies
10:57:24 PM: Finished saving emacs cask dependencies
10:57:24 PM: Started saving maven dependencies
10:57:24 PM: Finished saving maven dependencies
10:57:24 PM: Started saving boot dependencies
10:57:24 PM: Finished saving boot dependencies
10:57:24 PM: Started saving rust rustup cache
10:57:24 PM: Finished saving rust rustup cache
10:57:24 PM: Started saving go dependencies
10:57:24 PM: Finished saving go dependencies
10:57:25 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:57:25 PM: Failing build: Failed to build site
10:57:25 PM: Finished processing build request in 1m13.677s

My build settings:

My site ID: https://peaceful-mermaid-8e32a8.netlify.app/

@EpicAssasin678 The exit code isn’t the error, the actual error will be found higher in the build log.
Are you able to supply the entire log?

Hi @EpicAssasin678 :wave:t6: , welcome to the forums and thanks so much for reaching out.

Can you please give this support guide a read? Also confirm the steps you’ve taken to troubleshoot and of course the full log will be helpful.

I cannot because the log is far too long. It failed during compile on the build but succeeded on my local machine.

Change your build command to CI= npm run build.