# React project build error

**URL:** <https://answers.netlify.com/t/react-project-build-error/104574>\
**Category:** Support\
**Tags:** building, deployment\
**Created:** [October 16, 2023, 9:05pm UTC](https://answers.netlify.com/t/react-project-build-error/104574 "2023-10-16T21:05:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sravankumar-samala](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@sravankumar-samala](https://answers.netlify.com/u/sravankumar-samala)\
**Post date:** [October 16, 2023, 9:05pm UTC](https://answers.netlify.com/t/react-project-build-error/104574/1 "2023-10-16T21:05:28Z")

</div>

PLEASE help us help you by writing a good post!

- we need to know your netlify site name. Example: `gifted-antelope-58b104.netlify.app`
- DNS issues? Tell us the custom domain, tell us the error message! We can’t help if we don’t know your domain.
- Build problems? Link or paste the FULL build log & build settings screenshot

The better the post - the faster the answer.

The following is my failed build logs  
2:26:10 AM: Netlify Build  
2:26:10 AM: ────────────────────────────────────────────────────────────────  
2:26:10 AM: ​  
2:26:10 AM: ❯ Version  
2:26:10 AM: @netlify/build 29.22.5  
2:26:10 AM: ​  
2:26:10 AM: ❯ Flags  
2:26:10 AM: baseRelDir: true  
2:26:10 AM: buildId: 652da33b85048f13fdcb4482  
2:26:10 AM: deployId: 652da33b85048f13fdcb4484  
2:26:10 AM: ​  
2:26:10 AM: ❯ Current directory  
2:26:10 AM: /opt/build/repo  
2:26:10 AM: ​  
2:26:10 AM: ❯ Config file  
2:26:10 AM: No config file was defined: using default values.  
2:26:10 AM: ​  
2:26:10 AM: ❯ Context  
2:26:10 AM: production  
2:26:10 AM: ​  
2:26:10 AM: Build command from Netlify app  
2:26:10 AM: ────────────────────────────────────────────────────────────────  
2:26:10 AM: ​  
2:26:10 AM: $ npm run build  
2:26:10 AM: \> job-lang-loom@0.0.0 build  
2:26:10 AM: \> vite build  
2:26:10 AM: vite v4.4.11 building for production…  
2:26:10 AM: transforming…  
2:26:13 AM: ✓ 150 modules transformed.  
2:26:13 AM: rendering chunks…  
2:26:13 AM: computing gzip size…  
2:26:13 AM: dist/index.html 0.45 kB │ gzip: 0.30 kB  
2:26:13 AM: dist/assets/index-4ed69a70.css 10.91 kB │ gzip: 3.02 kB  
2:26:13 AM: dist/assets/index-de22b3ca.js 223.30 kB │ gzip: 72.68 kB  
2:26:13 AM: ✓ built in 2.62s  
2:26:13 AM: ​  
2:26:13 AM: (build.command completed in 3s)  
2:26:13 AM: ​  
2:26:15 AM: Failed during stage “building site”: Build script returned non-zero exit code: 2  
2:26:15 AM: Build failed due to a user error: Build script returned non-zero exit code: 2  
2:26:15 AM: Failing build: Failed to build site  
2:26:15 AM: Finished processing build request in 31.221s

---

<div class="post-metadata">

**Author:** ![nathanmartin](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/nathanmartin/32/30845_2.png) [@nathanmartin](https://answers.netlify.com/u/nathanmartin)\
**Post date:** [October 16, 2023, 10:37pm UTC](https://answers.netlify.com/t/react-project-build-error/104574/2 "2023-10-16T22:37:34Z")

</div>

@sravankumar-samala Can you provide the FULL build log?

As despite what it says, I know from experience that it’s entirely possible it actually failed during the “deploy” step.

---

<div class="post-metadata">

**Author:** ![Melvin](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/melvin/32/23606_2.png) [@Melvin](https://answers.netlify.com/u/Melvin)\
**Post date:** [October 17, 2023, 11:40am UTC](https://answers.netlify.com/t/react-project-build-error/104574/3 "2023-10-17T11:40:20Z")

</div>

Hi @sravankumar-samala,

Thanks for reaching out!

With the deployId from the log you provided, I was able to find the site. Looking at the [full deploy log](https://app.netlify.com/sites/curious-treacle-442f3d/deploys/652da33b85048f13fdcb4484#L106) I see:

```auto
Error message
Deploy did not succeed: Deploy directory "build" does not exist

```

Could you try following the solution mentioned in this Forum post:

> [@Build failed using vite+react](https://answers.netlify.com/t/build-failed-using-vite-react/52550/2):
>
> Hey @pranav This deploy has failed because… The directory build does not exist because Vite builds to the dist directory as shown in these lines Try changing the publish directory to dist and deploy again. Create React App does use build as the output directory, but many others (including Vite) use dist (and there is usually an option to specify a directory name should you want something else.)

Let us know if you have any questions.
