Build script returning non-zero exit code: 2

Hi there. New to Netlify as of a few days but I’ve had no issues until now. I’m deploying to my renamed Netlify@
seralyn.netlify.app
Source Repo: GitHub - Seralyn/seradevsite: More restrained version of personal website
I’ve done this a few times without any problems but I must have done…something…to break the build process and despite looking at the logs, it is not obvious to me.

In my attempts to self-troubleshoot, I have looked through:
Frequently Encountered Problems
Using Build Logs to debug Build Process
as well as several other people with this error, but their issues don’t seem to be the same as mine.

Here is a copy of my build log:

3:15:48 PM: Build ready to start
3:15:50 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
3:15:50 PM: build-image tag: v4.8.0
3:15:50 PM: buildbot version: e552b142336b2b1222a93a4fd4cbed0019c77b46
3:15:50 PM: Fetching cached dependencies
3:15:50 PM: Starting to download cache of 118.9MB
3:15:51 PM: Finished downloading cache in 1.356650349s
3:15:51 PM: Starting to extract cache
3:15:55 PM: Finished extracting cache in 3.914558478s
3:15:55 PM: Finished fetching cache in 5.282781121s
3:15:55 PM: Starting to prepare the repo for build
3:15:55 PM: Preparing Git Reference refs/heads/master
3:15:56 PM: Parsing package.json dependencies
3:15:57 PM: Starting build script
3:15:57 PM: Installing dependencies
3:15:57 PM: Python version set to 2.7
3:15:58 PM: Started restoring cached node version
3:15:59 PM: Finished restoring cached node version
3:15:59 PM: v16.14.2 is already installed.
3:15:59 PM: Now using node v16.14.2 (npm v8.5.0)
3:15:59 PM: Started restoring cached build plugins
3:15:59 PM: Finished restoring cached build plugins
3:16:00 PM: Attempting ruby version 2.7.2, read from environment
3:16:01 PM: Using ruby version 2.7.2
3:16:01 PM: Using PHP version 8.0
3:16:01 PM: No npm workspaces detected
3:16:01 PM: Started restoring cached node modules
3:16:01 PM: Finished restoring cached node modules
3:16:02 PM: Installing NPM modules using NPM version 8.5.0
3:16:08 PM: added 4 packages, changed 15 packages, and audited 1393 packages in 6s
3:16:08 PM: 172 packages are looking for funding
3:16:08 PM: run npm fund for details
3:16:08 PM: 12 vulnerabilities (5 moderate, 7 high)
3:16:08 PM: To address all issues (including breaking changes), run:
3:16:08 PM: npm audit fix --force
3:16:08 PM: Run npm audit for details.
3:16:08 PM: NPM modules installed
3:16:08 PM: Started restoring cached go cache
3:16:08 PM: Finished restoring cached go cache
3:16:08 PM: go version go1.16.5 linux/amd64
3:16:08 PM: go version go1.16.5 linux/amd64
3:16:08 PM: Installing missing commands
3:16:08 PM: Verify run directory
3:16:10 PM: ​
3:16:10 PM: ────────────────────────────────────────────────────────────────
3:16:10 PM: Netlify Build
3:16:10 PM: ────────────────────────────────────────────────────────────────
3:16:10 PM: ​
3:16:10 PM: ❯ Version
3:16:10 PM: @netlify/build 26.5.2
3:16:10 PM: ​
3:16:10 PM: ❯ Flags
3:16:10 PM: baseRelDir: true
3:16:10 PM: buildId: 62590d9410be237d259bda84
3:16:10 PM: deployId: 62590d9410be237d259bda86
3:16:10 PM: ​
3:16:10 PM: ❯ Current directory
3:16:10 PM: /opt/build/repo
3:16:10 PM: ​
3:16:10 PM: ❯ Config file
3:16:10 PM: No config file was defined: using default values.
3:16:10 PM: ​
3:16:10 PM: ❯ Context
3:16:10 PM: production
3:16:10 PM: ​
3:16:10 PM: ────────────────────────────────────────────────────────────────
3:16:10 PM: 1. Build command from Netlify app
3:16:10 PM: ────────────────────────────────────────────────────────────────
3:16:10 PM: ​
3:16:10 PM: $ npm run build
3:16:10 PM: > seradevsite@0.1.0 build
3:16:10 PM: > react-scripts build
3:16:11 PM: Creating an optimized production build…
3:16:21 PM:
3:16:21 PM: Treating warnings as errors because process.env.CI = true.
3:16:21 PM: Most CI servers set it automatically.
3:16:21 PM:
3:16:21 PM: Failed to compile.
3:16:21 PM:
3:16:21 PM: src/components/About.js
3:16:21 PM: Line 19:13: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text
3:16:21 PM: src/components/LandingPage.js
3:16:21 PM: Line 10:9: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text
3:16:21 PM: ​
3:16:21 PM: ────────────────────────────────────────────────────────────────
3:16:21 PM: “build.command” failed
3:16:21 PM: ────────────────────────────────────────────────────────────────
3:16:21 PM: ​
3:16:21 PM: Error message
3:16:21 PM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
3:16:21 PM: Creating deploy upload records
3:16:21 PM: ​
3:16:21 PM: Error location
3:16:21 PM: In Build command from Netlify app:
3:16:21 PM: npm run build
3:16:21 PM: ​
3:16:21 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)
3:16:21 PM: Resolved config
3:16:21 PM: build:
3:16:21 PM: command: npm run build
3:16:21 PM: commandOrigin: ui
3:16:21 PM: environment:
3:16:21 PM: - ONEGRAPH_AUTHLIFY_TOKEN
3:16:21 PM: publish: /opt/build/repo/build
3:16:21 PM: publishOrigin: ui
3:16:21 PM: Caching artifacts
3:16:21 PM: Started saving node modules
3:16:21 PM: Finished saving node modules
3:16:21 PM: Started saving build plugins
3:16:21 PM: Finished saving build plugins
3:16:21 PM: Started saving pip cache
3:16:21 PM: Finished saving pip cache
3:16:21 PM: Started saving emacs cask dependencies
3:16:21 PM: Finished saving emacs cask dependencies
3:16:21 PM: Started saving maven dependencies
3:16:21 PM: Finished saving maven dependencies
3:16:21 PM: Started saving boot dependencies
3:16:21 PM: Finished saving boot dependencies
3:16:21 PM: Started saving rust rustup cache
3:16:21 PM: Finished saving rust rustup cache
3:16:21 PM: Started saving go dependencies
3:16:21 PM: Finished saving go dependencies
3:16:21 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:16:21 PM: Failing build: Failed to build site
3:16:22 PM: Finished processing build request in 31.782508308s

Hi @Seralyn,

Try changing build command in your site settings to:

CI= npm run build

Thanks @hrishikesh ! Funnily enough, I figured that out after you posted this, but before I read it :stuck_out_tongue: Thanks for your help anyway!

that was supposed to be “npm” right? “rpm” is a typo?

Yes, my bad. It’s npm. Updated it now.