Netlify ‘building site’: Build script returned non-zero exit code: 1

I need help as I encounter error when trying to deploy github repository to Netlify :

1:24:15 PM: Failed to compile.
1:24:15 PM:
1:24:15 PM: ./src/views/about-us.js
1:24:15 PM: Line 3:10: ‘Hero’ is defined but never used no-unused-vars
1:24:15 PM: Line 3:16: ‘Content’ is defined but never used no-unused-vars
1:24:15 PM: ./src/views/external-api.js
1:24:15 PM: Line 6:19: ‘setMessage’ is assigned a value but never used no-unused-vars
1:24:15 PM: ​
1:24:15 PM: ────────────────────────────────────────────────────────────────
1:24:15 PM: “build.command” failed
1:24:15 PM: ────────────────────────────────────────────────────────────────
1:24:15 PM: ​
1:24:15 PM: Error message
1:24:15 PM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
1:24:15 PM: ​
1:24:15 PM: Error location
1:24:15 PM: In Build command from Netlify app:
1:24:15 PM: npm run build
1:24:15 PM: ​
1:24:15 PM: Resolved config
1:24:15 PM: build:
1:24:15 PM: command: npm run build
1:24:15 PM: commandOrigin: ui
1:24:15 PM: publish: /opt/build/repo/build
1:24:15 PM: publishOrigin: ui
1:24:16 PM: Caching artifacts
1:24:16 PM: Started saving node modules
1:24:16 PM: Finished saving node modules
1:24:16 PM: Started saving build plugins
1:24:16 PM: Finished saving build plugins
1:24:16 PM: Started saving pip cache
1:24:16 PM: Finished saving pip cache
1:24:16 PM: Started saving emacs cask dependencies
1:24:16 PM: Finished saving emacs cask dependencies
1:24:16 PM: Started saving maven dependencies
1:24:16 PM: Finished saving maven dependencies
1:24:16 PM: Started saving boot dependencies
1:24:16 PM: Finished saving boot dependencies
1:24:16 PM: Started saving rust rustup cache
1:24:16 PM: Finished saving rust rustup cache
1:24:16 PM: Started saving go dependencies
1:24:16 PM: Finished saving go dependencies
1:24:17 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:24:17 PM: Creating deploy upload records
1:24:18 PM: Failing build: Failed to build site
1:24:18 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)
1:24:18 PM: Finished processing build request in 1m29.379196186s

Hey @tanchdedx

The error messages here are saying there are variables defined in these files that aren’t used in the code. If you remove these unused variables the deploy should (hopefully) succeed.