Something wrong with my React app deploy

I can not deploy my site. Here is the deploy log:

10:01:13 PM: ❯ Current directory
10:01:13 PM: /opt/build/repo
10:01:13 PM: ​
10:01:13 PM: ❯ Config file
10:01:13 PM: No config file was defined: using default values.
10:01:13 PM: ​
10:01:13 PM: ❯ Context
10:01:13 PM: production
10:01:13 PM: ​
10:01:13 PM: 1. Build command from Netlify app
10:01:14 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
10:01:13 PM: ────────────────────────────────────────────────────────────────
10:01:13 PM: ​
10:01:13 PM: $ npm run build
10:01:13 PM: > ant-project@0.1.0 build
10:01:13 PM: > CI=react-scripts build
10:01:13 PM: sh: 1: build: not found
10:01:13 PM: ​
10:01:13 PM: “build.command” failed
10:01:13 PM: ────────────────────────────────────────────────────────────────
10:01:13 PM: ​
10:01:13 PM: Error message
10:01:13 PM: Command failed with exit code 127: npm run build (Search results for '"non-zero exit code: 127"' - Netlify Support Forums)
10:01:13 PM: ​
10:01:13 PM: Error location
10:01:13 PM: In Build command from Netlify app:
10:01:13 PM: npm run build
10:01:13 PM: ​
10:01:13 PM: Resolved config
10:01:13 PM: build:
10:01:13 PM: command: npm run build
10:01:13 PM: commandOrigin: ui
10:01:13 PM: publish: /opt/build/repo/build
10:01:13 PM: publishOrigin: ui
10:01:13 PM: Caching artifacts
10:01:13 PM: Started saving node modules
10:01:13 PM: Finished saving node modules
10:01:13 PM: Started saving build plugins
10:01:13 PM: Finished saving build plugins
10:01:13 PM: Started saving pip cache
10:01:13 PM: Finished saving pip cache
10:01:13 PM: Started saving emacs cask dependencies
10:01:13 PM: Finished saving emacs cask dependencies
10:01:13 PM: Started saving maven dependencies
10:01:13 PM: Finished saving maven dependencies
10:01:13 PM: Started saving boot dependencies
10:01:13 PM: Finished saving boot dependencies
10:01:13 PM: Started saving rust rustup cache
10:01:13 PM: Finished saving rust rustup cache
10:01:13 PM: Started saving go dependencies
10:01:13 PM: Finished saving go dependencies
10:01:13 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:01:13 PM: Failing build: Failed to build site
10:01:14 PM: Finished processing build request in 27.034446557s

Hi @ChandanSayed :wave:t6: ,

Welcome to the forums glad you’re here! :slightly_smiling_face:

Can you please supply your site name/slug? Did you get it working locally first? If not please do that.

Finally, please give this resource a read as it may likely help resolve your problem. This is a compilation of all of our deploy and build guides to help you troubleshoot.

Thanks for your reply. I have solved it. I have added environment CI = false. And It works for me.

Hi @ChandanSayed :wave:t6: ,

Thanks for coming back and letting us know. This will help others who encounter similar issues.

1 Like