# Build script returned non-zero exit code: 2

**URL:** <https://answers.netlify.com/t/build-script-returned-non-zero-exit-code-2/53458>\
**Category:** Support\
**Tags:** create-react-app, deployment\
**Created:** [March 15, 2022, 5:52am UTC](https://answers.netlify.com/t/build-script-returned-non-zero-exit-code-2/53458 "2022-03-15T05:52:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fatwalrus619](https://avatars.discourse-cdn.com/v4/letter/f/e274bd/32.png) [@fatwalrus619](https://answers.netlify.com/u/fatwalrus619)\
**Post date:** [March 15, 2022, 5:52am UTC](https://answers.netlify.com/t/build-script-returned-non-zero-exit-code-2/53458/1 "2022-03-15T05:52:26Z")

</div>

> **[Netlify App](https://app.netlify.com/sites/trusting-austin-c50b3f)**
>
> Start building the best web experiences in record time

Please help!

8:59:21 PM: Build ready to start  
8:59:37 PM: build-image version: 122b31996ccaffd45d820a452d6227f8312110cc (focal)  
8:59:37 PM: build-image tag: v4.5.3  
8:59:37 PM: buildbot version: 7eafb394e33f42f945c880ce4ac17c149867813a  
8:59:37 PM: Fetching cached dependencies  
8:59:37 PM: Failed to fetch cache, continuing with build  
8:59:37 PM: Starting to prepare the repo for build  
8:59:37 PM: No cached dependencies found. Cloning fresh repo  
8:59:37 PM: git clone [GitHub - markolsen619/Walrus-Dao](https://github.com/markolsen619/Walrus-Dao)  
8:59:38 PM: Preparing Git Reference refs/heads/walrusdao  
8:59:38 PM: Parsing package.json dependencies  
8:59:39 PM: Starting build script  
8:59:39 PM: Installing dependencies  
8:59:39 PM: Python version set to 2.7  
8:59:39 PM: Attempting node version ‘16’ from .nvmrc  
8:59:40 PM: Downloading and installing node v16.14.0…  
8:59:40 PM: Downloading [https://nodejs.org/dist/v16.14.0/node-v16.14.0-linux-x64.tar.xz](https://nodejs.org/dist/v16.14.0/node-v16.14.0-linux-x64.tar.xz)…  
8:59:40 PM: Computing checksum with sha256sum  
8:59:40 PM: Checksums matched!  
8:59:43 PM: Now using node v16.14.0 (npm v8.3.1)  
8:59:43 PM: Started restoring cached build plugins  
8:59:43 PM: Finished restoring cached build plugins  
8:59:43 PM: Attempting ruby version 2.7.2, read from environment  
8:59:44 PM: Using ruby version 2.7.2  
8:59:45 PM: Using PHP version 8.0  
8:59:45 PM: Started restoring cached node modules  
8:59:45 PM: Finished restoring cached node modules  
8:59:45 PM: Installing NPM modules using NPM version 8.3.1  
9:00:00 PM: npm WARN deprecated safe-event-emitter@1.0.1: Renamed to @metamask/safe-event-emitter  
9:00:03 PM: npm WARN deprecated eth-sig-util@1.4.2: Deprecated in favor of ‘@metamask/eth-sig-util’  
9:00:05 PM: npm WARN deprecated @walletconnect/mobile-registry@1.4.0: Deprecated in favor of dynamic registry available from: [GitHub - WalletConnect/walletconnect-registry: App Registry for WalletConnect Protocol](https://github.com/walletconnect/walletconnect-registry)  
9:00:07 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.  
9:00:08 PM: npm WARN deprecated walletlink@2.5.0: WARNING: This project has been renamed to @coinbase/wallet-sdk. Install using @coinbase/wallet-sdk instead.  
9:00:14 PM: added 1604 packages, and audited 1605 packages in 29s  
9:00:14 PM: 211 packages are looking for funding  
9:00:14 PM: run `npm fund` for details  
9:00:14 PM: 18 moderate severity vulnerabilities  
9:00:14 PM: To address all issues possible (including breaking changes), run:  
9:00:14 PM: npm audit fix --force  
9:00:14 PM: Some issues need review, and may require choosing  
9:00:14 PM: a different dependency.  
9:00:14 PM: Run `npm audit` for details.  
9:00:14 PM: NPM modules installed  
9:00:15 PM: Started restoring cached go cache  
9:00:15 PM: Finished restoring cached go cache  
9:00:15 PM: go version go1.16.5 linux/amd64  
9:00:15 PM: go version go1.16.5 linux/amd64  
9:00:15 PM: Installing missing commands  
9:00:15 PM: Verify run directory  
9:00:16 PM: ​  
9:00:16 PM: ────────────────────────────────────────────────────────────────  
9:00:16 PM: Netlify Build  
9:00:16 PM: ────────────────────────────────────────────────────────────────  
9:00:16 PM: ​  
9:00:16 PM: ❯ Version  
9:00:16 PM: @netlify/build 26.4.0  
9:00:16 PM: ​  
9:00:16 PM: ❯ Flags  
9:00:16 PM: baseRelDir: true  
9:00:16 PM: buildId: 62300f193d7b99371c7664f9  
9:00:16 PM: deployId: 62300f193d7b99371c7664fb  
9:00:16 PM: ​  
9:00:16 PM: ❯ Current directory  
9:00:16 PM: /opt/build/repo  
9:00:16 PM: ​  
9:00:16 PM: ❯ Config file  
9:00:16 PM: No config file was defined: using default values.  
9:00:16 PM: ​  
9:00:16 PM: ❯ Context  
9:00:16 PM: production  
9:00:16 PM: ​  
9:00:16 PM: ────────────────────────────────────────────────────────────────  
9:00:16 PM: 1. Build command from Netlify app  
9:00:16 PM: ────────────────────────────────────────────────────────────────  
9:00:16 PM: ​  
9:00:16 PM: $ npm run build  
9:00:16 PM: \> mydao@0.1.0 build  
9:00:16 PM: \> react-scripts build  
9:00:17 PM: Creating an optimized production build…  
9:01:17 PM:  
9:01:17 PM: Treating warnings as errors because process.env.CI = true.  
9:01:17 PM: Most CI servers set it automatically.  
9:01:17 PM:  
9:01:17 PM: Failed to compile.  
9:01:17 PM:  
9:01:17 PM: src/App.jsx  
9:01:17 PM: Line 179:6: React Hook useEffect has a missing dependency: ‘error’. Either include it or remove the dependency array react-hooks/exhaustive-deps  
9:01:17 PM: ​  
9:01:17 PM: ────────────────────────────────────────────────────────────────  
9:01:17 PM: “build.command” failed  
9:01:17 PM: ────────────────────────────────────────────────────────────────  
9:01:17 PM: ​  
9:01:17 PM: Error message  
9:01:17 PM: Command failed with exit code 1: npm run build ([Search results for '"non-zero exit code: 1"' - Netlify Support Forums](https://ntl.fyi/exit-code-1))  
9:01:17 PM: ​  
9:01:17 PM: Error location  
9:01:17 PM: In Build command from Netlify app:  
9:01:17 PM: npm run build  
9:01:17 PM: ​  
9:01:17 PM: Resolved config  
9:01:17 PM: build:  
9:01:17 PM: command: npm run build  
9:01:17 PM: commandOrigin: ui  
9:01:17 PM: publish: /opt/build/repo/build  
9:01:17 PM: publishOrigin: ui  
9:01:18 PM: Caching artifacts  
9:01:18 PM: Started saving node modules  
9:01:18 PM: Finished saving node modules  
9:01:18 PM: Started saving build plugins  
9:01:18 PM: Finished saving build plugins  
9:01:18 PM: Started saving pip cache  
9:01:18 PM: Finished saving pip cache  
9:01:18 PM: Started saving emacs cask dependencies  
9:01:18 PM: Finished saving emacs cask dependencies  
9:01:18 PM: Started saving maven dependencies  
9:01:18 PM: Finished saving maven dependencies  
9:01:18 PM: Started saving boot dependencies  
9:01:18 PM: Finished saving boot dependencies  
9:01:18 PM: Started saving rust rustup cache  
9:01:18 PM: Finished saving rust rustup cache  
9:01:18 PM: Started saving go dependencies  
9:01:18 PM: Finished saving go dependencies  
9:01:20 PM: Build failed due to a user error: Build script returned non-zero exit code: 2  
9:01:20 PM: Creating deploy upload records  
9:01:20 PM: Failing build: Failed to build site  
9:01:20 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](https://ntl.fyi/exit-code-2))  
9:01:20 PM: Finished processing build request in 1m43.335951001s

---

<div class="post-metadata">

**Author:** ![kanyekim](https://avatars.discourse-cdn.com/v4/letter/k/ea5d25/32.png) [@kanyekim](https://answers.netlify.com/u/kanyekim)\
**Post date:** [March 15, 2022, 12:09pm UTC](https://answers.netlify.com/t/build-script-returned-non-zero-exit-code-2/53458/2 "2022-03-15T12:09:34Z")

</div>

Let’s see them and follow the following steps given below  
11:59:46 AM: Build ready to start  
11:59:48 AM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6  
11:59:48 AM: build-image tag: v3.4.1  
11:59:48 AM: buil the dbot version: 0a44c930054be748eff0c581d346282fece89cc0  
11:59:48 AM: Building without cache  
11:59:48 AM: Starting to prepare the repo for build  
11:59:48 AM: No cached dependencies found. Cloning fresh repo

11:59:49 AM: Preparing Git Reference refs/heads/master  
11:59:50 AM: Starting build script  
11:59:50 AM: Installing dependencies  
11:59:50 AM: Python version set to 2.7  
11:59:51 AM: v12.18.0 is already installed.  
11:59:52 AM: Now using node v12.18.0 (npm v6.14.4)  
11:59:52 AM: Started restoring cached build plugins  
11:59:52 AM: Finished restoring cached build plugins  
11:59:52 AM: Attempting ruby version 2[.](http://kanyewestmerch.ltd/)7.1, read from the environment  
11:59:53 AM: Using ruby version 2.7.1  
11:59:54 AM: Using PHP version 5.6  
11:59:54 AM: 5.2 is already installed.  
11:59:54 AM: Using Swift version 5.2  
11:59:54 AM: Started restoring cached node modules  
11:59:54 AM: Finished restoring cached node modules  
11:59:54 AM: Started restoring cached yarn cache  
11:59:54 AM: Finished restoring cached yarn cache  
11:59:54 AM: Installing yarn at version 1.22.4  
11:59:54 AM: Installing Yarn!  
11:59:54 AM: \> Downloading tarball…

11:59:54 AM: % Total % Received % Xferd Average Speed Time Time Time Current  
11:59:54 AM: Dload Upload Total Spent Left Speed  
11:59:54 AM: 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0  
11:59:54 AM: 100 80 100 80 0 0 285 0 --:–:-- --:–:-- --:–:-- 285  
11:59:54 AM: 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0  
11:59:54 AM: 100 93 100 93 0 0 156 0 --:–:-- --:–:-- --:–:-- 556  
11:59:55 AM: 100 643 100 643 0 0 749 0 --:–:-- --:–:-- --:–:-- 749  
11:59:55 AM: 100 1215k 100 1215k 0 0 947k 0 0:00:01 0:00:01 --:–:-- 947k  
/tmp/yarn.tar.gz.aq7yGqZqlV.asc  
11:59:55 AM: 100 84 100 84 0 0 3088 0 --:–:-- --:–:-- --:–:-- 3088  
11:59:55 AM: 100 97 100 97 0 0 1692 0 --:–:-- --:–:-- --:–:-- 1692  
11:59:55 AM: 100 647 100 647 0 0 7321 0 --:–:-- --:–:-- --:–:-- 7321  
11:59:55 AM: 0 1028 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0  
11:59:55 AM: 100 1028 100 1028 0 0 8135 0 --:–:-- --:–:-- --:–:-- 1003k  
11:59:55 AM: \> Verifying integrity…  
11:59:55 AM: gpg: Signature made Mon 09 Mar 2020 03:52:13 PM UTC using RSA key ID 69475BAA

11:59:55 AM: gpg: WARNING: This key is not certified with a trusted signature!  
11:59:55 AM: gpg: There is no indication that the signature belongs to the owner.  
11:59:55 AM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310  
11:59:55 AM: Subkey fingerprint: 6D98 490C 6F1A CDDD 448E 4595 4F77 6793 6947 5BAA  
11:59:55 AM: \> GPG signature looks good  
11:59:55 AM: \> Extracting to ~/.yarn…  
11:59:55 AM: \> Adding to $PATH…  
11:59:56 AM: \> Successfully installed Yarn 1.22.4! Please open another terminal where the `yarn` command will now be available.  
11:59:56 AM: Installing NPM modules using Yarn version 1.22.4  
11:59:57 AM: yarn install v1.22.4  
11:59:57 AM: [1/4] Resolving packages…  
11:59:58 AM: [2/4] Fetching packages…  
12:00:22 PM: info fsevents@2.1.2: The platform “linux” is incompatible with this module.  
12:00:22 PM: info “fsevents@2.1.2” is an optional dependency and failed compatibility check. Excluding it from installation.  
12:00:22 PM: info fsevents@1.2.12: The platform “linux” is incompatible with this module.  
12:00:22 PM: info “fsevents@1.2.12” is an optional dependency and failed compatibility check. Excluding it from installation.  
12:00:22 PM: [3/4] Linking dependencies…

> = 3.5.0-dev || \>= 3.6.0-dev || \>= 3.6.0-beta || \>= 3.7.0-dev || \>= 3.7.0-beta".  
> 12:00:34 PM: [4/4] Building fresh packages…  
> 12:00:36 PM: success Saved lockfile.  
> 12:00:36 PM: Done in 38.98s.  
> 12:00:36 PM: NPM modules installed using Yarn  
> 12:00:36 PM: Started restoring cached go cache  
> 12:00:36 PM: Finished restoring cached go cache  
> 12:00:36 PM: go version go1.14.4 linux/amd64  
> 12:00:36 PM: go version go1.14.4 Linux/amd64  
> 12:00:36 PM: Installing missing commands  
> 12:00:36 PM: Verify run directory  
> 12:00:37 PM: ​  
> 12:00:37 PM: ┌─────────────────────────────┐  
> 12:00:37 PM: │ Netlify Build │  
> 12:00:37 PM: └─────────────────────────────┘  
> 12:00:37 PM: ​  
> 12:00:37 PM: ❯ Version

12:00:37 PM: ​  
12:00:37 PM: ❯ Flags  
12:00:37 PM: deploy: 5f9069020af24e00933f58d3  
12:00:37 PM: mode: buildbot  
12:00:37 PM: ​  
12:00:37 PM: ❯ Current directory  
12:00:37 PM: /opt/build/repo  
12:00:37 PM: ​  
12:00:37 PM: ❯ Config file  
12:00:37 PM: No config file was defined: using default values.  
12:00:37 PM: ​  
12:00:37 PM: ❯ Context  
12:00:37 PM: production  
12:00:37 PM: ​  
12:00:37 PM: ┌───────────────────────────────────┐  
12:00:37 PM: │ 1. Build command from Netlify app │  
12:00:37 PM: └───────────────────────────────────┘  
12:00:37 PM: ​  
12:00:37 PM: $ yarn build  
12:00:38 PM: yarn run v1.22.4  
12:00:38 PM: $ react-scripts build  
12:00:39 PM: Creating an optimized production build…  
12:00:41 PM: Browserslist: caniuse-lite is outdated. Please run the following command: `npx browserslist --update-db`  
12:00:42 PM: Failed to compile.  
12:00:42 PM:  
12:00:42 PM: ./src/index.js  
12:00:42 PM: Cannot find file ‘./app.js’ in ‘./src’.  
12:00:42 PM: error Command failed with exit code 1.  
12:00:42 PM: ​  
12:00:42 PM: ┌─────────────────────────────┐  
12:00:42 PM: │ “build.command” failed │  
12:00:42 PM: └─────────────────────────────┘  
12:00:42 PM: ​  
12:00:42 PM: Error message  
12:00:42 PM: Command failed with exit code 1: yarn build  
12:00:42 PM: ​  
12:00:42 PM: Error location  
12:00:42 PM: In Build command from Netlify app:  
12:00:42 PM: yarn build  
12:00:42 PM: ​  
12:00:42 PM: Resolved config  
12:00:42 PM: build:  
12:00:42 PM: command: yarn build  
12:00:42 PM: commandOrigin: ui  
12:00:42 PM: publish: /opt/build/repo/build  
12:00:42 PM: Caching artifacts  
12:00:42 PM: Started saving node modules  
12:00:42 PM: Finished saving node modules  
12:00:42 PM: Started saving build plugins  
12:00:42 PM: Finished saving build plugins  
12:00:42 PM: Started saving yarn cache  
12:00:42 PM: Finished saving yarn cache  
12:00:42 PM: Started saving pip cache  
12:00:42 PM: Finished saving pip cache  
12:00:42 PM: Started saving emacs cask dependencies  
12:00:42 PM: Finished saving emacs cask dependencies  
12:00:42 PM: Started saving maven dependencies  
12:00:42 PM: Finished saving maven dependencies  
12:00:42 PM: Started saving boot dependencies  
12:00:42 PM: Finished saving boot dependencies  
12:00:42 PM: Started saving go dependencies  
12:00:42 PM: Finished saving go dependencies  
12:00:45 PM: Build failed due to a user error: Build script returned non-zero exit code: 2  
12:00:45 PM: Failing build: Failed to build site  
12:00:45 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2  
12:00:45 PM: Finished processing build request in 57.736891768s  
Enjoyed And be safe from the scammers don’t share any sensitive information on that plateform.

---

<div class="post-metadata">

**Author:** ![hillary](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hillary/32/21132_2.png) [@hillary](https://answers.netlify.com/u/hillary)\
**Post date:** [March 15, 2022, 12:31pm UTC](https://answers.netlify.com/t/build-script-returned-non-zero-exit-code-2/53458/3 "2022-03-15T12:31:16Z")

</div>

hey folks,

Thanks so much for reaching out! @fatwalrus619, can you please share your build settings for us to check?

@kanyekim, can you please share a link to your site as well as your build settings?

Lastly, we are currently investigating delays in our self-serve build system which make be impacting builds right now. That being said, they would not have impacted your builds 6 hours ago, @fatwalrus619. For more information, you can follow along here: [Netlify Status - Delay in our Self-Server Build system](https://www.netlifystatus.com/incidents/lzpn56hymd7r)

---

<div class="post-metadata">

**Author:** ![fatwalrus619](https://avatars.discourse-cdn.com/v4/letter/f/e274bd/32.png) [@fatwalrus619](https://answers.netlify.com/u/fatwalrus619)\
**Post date:** [March 15, 2022, 5:21pm UTC](https://answers.netlify.com/t/build-script-returned-non-zero-exit-code-2/53458/4 "2022-03-15T17:21:16Z")

</div>

Im not sure what you need for build settings.  
here is the link to my project on github:

> **[GitHub - markolsen619/Walrus-Dao](https://github.com/markolsen619/Walrus-Dao)**
>
> Contribute to markolsen619/Walrus-Dao development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![coelmay](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/coelmay/32/24427_2.png) [@coelmay](https://answers.netlify.com/u/coelmay)\
**Post date:** [March 15, 2022, 8:58pm UTC](https://answers.netlify.com/t/build-script-returned-non-zero-exit-code-2/53458/5 "2022-03-15T20:58:31Z")

</div>

Hey @fatwalrus619

It would appear this is the specific issue stopping your build from succeeding.

> [@fatwalrus619](#):
>
> Line 179:6: React Hook useEffect has a missing dependency: ‘error’. Either include it or remove the dependency array react-hooks/exhaustive-deps
