# Error in building react app

**URL:** <https://answers.netlify.com/t/error-in-building-react-app/98433>\
**Category:** Support\
**Tags:** building\
**Created:** [August 6, 2023, 6:38pm UTC](https://answers.netlify.com/t/error-in-building-react-app/98433 "2023-08-06T18:38:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanyam1396](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/sanyam1396/32/51401_2.png) [@sanyam1396](https://answers.netlify.com/u/sanyam1396)\
**Post date:** [August 6, 2023, 6:38pm UTC](https://answers.netlify.com/t/error-in-building-react-app/98433/1 "2023-08-06T18:38:59Z")

</div>

Netlify site name:  
stunning-melomakarona-98b2d6.netlify.app]([https://stunning-melomakarona-98b2d6.netlify.app](https://stunning-melomakarona-98b2d6.netlify.app)

Custom domain name:

#### [quilltome.com](http://quilltome.com/)

While deployin my react app, I am getting build failed. Below are the logs:

11:27:34 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 ([Search results for '"non-zero exit code: 2"' - Netlify Support Forums](https://ntl.fyi/exit-code-2))  
11:26:30 AM: build-image version: 20e1f1f500e4cbad9ea8a99bd40807bef3093551 (focal)  
11:26:30 AM: buildbot version: 77071362d8e2c4892a900c59914f4f5b20867e29  
17:11 AM: Install dependencies script success  
11:27:11 AM: Starting build script  
11:27:11 AM: Detected 1 framework(s)  
11:27:11 AM: create-react-app at version 5.0.1  
11:27:11 AM: Section completed: initializing  
11:27:13 AM: ​  
11:27:13 AM: Netlify Build  
11:27:13 AM: ────────────────────────────────────────────────────────────────  
11:27:13 AM: ​  
11:27:13 AM: ❯ Version  
11:27:13 AM: @netlify/build 29.17.4  
11:27:13 AM: ​  
11:27:13 AM: ❯ Flags  
11:27:13 AM: baseRelDir: true  
11:27:13 AM: buildId: 64cfd7c4d8fb1000080cb3d7  
11:27:13 AM: deployId: 64cfd7c4d8fb1000080cb3d9  
11:27:13 AM: ​  
11:27:13 AM: ❯ Current directory  
11:27:13 AM: /opt/build/repo  
11:27:13 AM: ​  
11:27:13 AM: ❯ Config file  
11:27:13 AM: /opt/build/repo/netlify.toml  
11:27:13 AM: ​  
11:27:13 AM: ❯ Context  
11:27:13 AM: production  
11:27:13 AM: ​  
11:27:13 AM: build.command from netlify.toml  
11:27:13 AM: ────────────────────────────────────────────────────────────────  
11:27:13 AM: ​  
11:27:13 AM: $ CI= npm run build  
11:27:13 AM: \> frontend@0.1.0 build /opt/build/repo  
11:27:13 AM: \> react-scripts build  
11:27:14 AM: Creating an optimized production build…  
11:27:31 AM: Compiled successfully.  
11:27:31 AM:  
11:27:31 AM: File sizes after gzip:  
11:27:31 AM: 125.43 kB build/static/js/main.80ec7458.js  
11:27:31 AM: 34.5 kB build/static/css/main.80f4832a.css  
11:27:31 AM: 1.78 kB build/static/js/787.cda612ba.chunk.js  
11:27:31 AM: The project was built assuming it is hosted at /.  
11:27:31 AM: You can control this with the homepage field in your package.json.  
11:27:31 AM: The build folder is ready to be deployed.  
11:27:31 AM: You may serve it with a static server:  
11:27:31 AM: npm install -g serve  
11:27:31 AM: serve -s build  
11:27:31 AM: Find out more about deployment here:  
11:27:31 AM: [Deployment | Create React App](https://cra.link/deployment)  
11:27:31 AM: ​  
11:27:31 AM: (build.command completed in 18.5s)  
11:27:31 AM: ​  
11:27:31 AM: Deploy site  
11:27:31 AM: ────────────────────────────────────────────────────────────────  
11:27:31 AM: ​  
11:27:31 AM: Section completed: deploying  
11:27:31 AM: ​  
11:27:31 AM: Configuration error  
11:27:31 AM: ────────────────────────────────────────────────────────────────  
11:27:31 AM: ​  
11:27:31 AM: Error message  
11:27:31 AM: Deploy did not succeed: Deploy directory ‘dist’ does not exist  
11:27:31 AM: ​  
11:27:31 AM: Resolved config  
11:27:31 AM: build:  
11:27:31 AM: command: CI= npm run build  
11:27:31 AM: commandOrigin: config  
11:27:31 AM: environment:  
11:27:31 AM: - CI  
11:27:31 AM: - NODE\_ENV  
11:27:31 AM: publish: /opt/build/repo/dist  
11:27:31 AM: publishOrigin: config  
11:27:32 AM: Caching artifacts  
11:27:32 AM: Started saving node modules  
11:27:32 AM: Finished saving node modules  
11:27:32 AM: Started saving build plugins  
11:27:32 AM: Finished saving build plugins  
11:27:32 AM: Started saving corepack cache  
11:27:32 AM: Finished saving corepack cache  
11:27:32 AM: Started saving pip cache  
11:27:32 AM: Finished saving pip cache  
11:27:32 AM: Started saving emacs cask dependencies  
11:27:32 AM: Finished saving emacs cask dependencies  
11:27:32 AM: Started saving maven dependencies  
11:27:32 AM: Finished saving maven dependencies  
11:27:32 AM: Started saving boot dependencies  
11:27:32 AM: Finished saving boot dependencies  
11:27:32 AM: Started saving rust rustup cache  
11:27:32 AM: Finished saving rust rustup cache  
11:27:32 AM: Started saving go dependencies  
11:27:32 AM: Finished saving go dependencies  
11:27:34 AM: Build failed due to a user error: Build script returned non-zero exit code: 2  
11:27:34 AM: Failing build: Failed to build site  
11:27:34 AM: Finished processing build request in 1m3.998s

Build settings:—

Runtime - Not set

Base directory - Not set

Build command - CI=’ ’ npm run build

Publish directory - build

Deploy log visibility - Logs are public

Build status - Active

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [August 6, 2023, 6:46pm UTC](https://answers.netlify.com/t/error-in-building-react-app/98433/2 "2023-08-06T18:46:03Z")

</div>

Try re-deploying. You’ve already got the correct settings.
