Command failed with exit code 1: npm run build base: /opt/build/repo/ecommercewebsite

Trying to deploy a react app and keep getting this error

  • we need to know your netlify site name. Example: gregarious-klepon-c083b4

11:21:17 AM: Build ready to start
11:21:20 AM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
11:21:20 AM: build-image tag: v4.8.0
11:21:20 AM: buildbot version: e552b142336b2b1222a93a4fd4cbed0019c77b46
11:21:20 AM: Fetching cached dependencies
11:21:20 AM: Failed to fetch cache, continuing with build
11:21:20 AM: Starting to prepare the repo for build
11:21:20 AM: No cached dependencies found. Cloning fresh repo
11:21:20 AM: git clone https://github.com/raboomar/tekcamp
11:21:22 AM: Preparing Git Reference refs/heads/develop
11:21:23 AM: Parsing package.json dependencies
11:21:23 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘ecommercewebsite/build’ versus ‘build’ in the Netlify UI
11:21:24 AM: Starting build script
11:21:24 AM: Installing dependencies
11:21:24 AM: Python version set to 2.7
11:21:25 AM: v16.14.2 is already installed.
11:21:26 AM: Now using node v16.14.2 (npm v8.5.0)
11:21:26 AM: Started restoring cached build plugins
11:21:26 AM: Finished restoring cached build plugins
11:21:26 AM: Attempting ruby version 2.7.2, read from environment
11:21:28 AM: Using ruby version 2.7.2
11:21:28 AM: Using PHP version 8.0
11:21:29 AM: No npm workspaces detected
11:21:29 AM: Started restoring cached node modules
11:21:29 AM: Finished restoring cached node modules
11:21:29 AM: Installing NPM modules using NPM version 8.5.0
11:21:42 AM: npm WARN deprecated source-map-url@0.4.1: See GitHub - lydell/source-map-url: [DEPRECATED] Tools for working with sourceMappingURL comments.
11:21:45 AM: npm WARN deprecated source-map-resolve@0.6.0: See GitHub - lydell/source-map-resolve: [DEPRECATED] Resolve the source map and/or sources for a generated file.
11:21:56 AM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
11:22:05 AM: added 1453 packages, and audited 1454 packages in 36s
11:22:05 AM: 177 packages are looking for funding
11:22:05 AM: run npm fund for details
11:22:05 AM: 8 vulnerabilities (6 moderate, 1 high, 1 critical)
11:22:05 AM: To address issues that do not require attention, run:
11:22:05 AM: npm audit fix
11:22:05 AM: To address all issues (including breaking changes), run:
11:22:05 AM: npm audit fix --force
11:22:05 AM: Run npm audit for details.
11:22:05 AM: NPM modules installed
11:22:06 AM: Started restoring cached go cache
11:22:06 AM: Finished restoring cached go cache
11:22:06 AM: go version go1.16.5 linux/amd64
11:22:06 AM: go version go1.16.5 linux/amd64
11:22:06 AM: Installing missing commands
11:22:06 AM: Verify run directory
11:22:08 AM: ​
11:22:08 AM: ────────────────────────────────────────────────────────────────
11:22:08 AM: Netlify Build
11:22:08 AM: ────────────────────────────────────────────────────────────────
11:22:08 AM: ​
11:22:08 AM: ❯ Version
11:22:08 AM: @netlify/build 26.5.2
11:22:08 AM: ​
11:22:08 AM: ❯ Flags
11:22:08 AM: baseRelDir: true
11:22:08 AM: buildId: 625598ed13846a0009d20bd1
11:22:08 AM: deployId: 625598ed13846a0009d20bd3
11:22:08 AM: ​
11:22:08 AM: ❯ Current directory
11:22:08 AM: /opt/build/repo/ecommercewebsite
11:22:08 AM: ​
11:22:08 AM: ❯ Config file
11:22:08 AM: No config file was defined: using default values.
11:22:08 AM: ​
11:22:08 AM: ❯ Context
11:22:08 AM: production
11:22:08 AM: ​
11:22:08 AM: ────────────────────────────────────────────────────────────────
11:22:08 AM: 1. Build command from Netlify app
11:22:08 AM: ────────────────────────────────────────────────────────────────
11:22:08 AM: ​
11:22:08 AM: $ npm run build
11:22:08 AM: > ecommercewebsite@0.1.0 build
11:22:08 AM: > react-scripts build
11:22:10 AM: Creating an optimized production build…
11:22:45 AM:
11:22:45 AM: Treating warnings as errors because process.env.CI = true.
11:22:45 AM: Most CI servers set it automatically.
11:22:45 AM:
11:22:45 AM: Failed to compile.
11:22:45 AM:
11:22:45 AM: src/App.js
11:22:45 AM: Line 16:16: ‘setData’ is assigned a value but never used no-unused-vars
11:22:45 AM: Line 17:16: ‘setCart’ is assigned a value but never used no-unused-vars
11:22:45 AM: src/CartItemView.jsx
11:22:45 AM: Line 10:17: ‘setitems’ is assigned a value but never used no-unused-vars
11:22:45 AM: Line 11:15: ‘settotal’ is assigned a value but never used no-unused-vars
11:22:45 AM: src/Filter.jsx
11:22:45 AM: Line 13:37: Array.prototype.filter() expects a value to be returned at the end of arrow function array-callback-return
11:22:45 AM: ​
11:22:45 AM: ────────────────────────────────────────────────────────────────
11:22:45 AM: “build.command” failed
11:22:45 AM: ────────────────────────────────────────────────────────────────
11:22:45 AM: ​
11:22:45 AM: Error message
11:22:45 AM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
11:22:45 AM: ​
11:22:45 AM: Error location
11:22:45 AM: In Build command from Netlify app:
11:22:45 AM: npm run build
11:22:45 AM: ​
11:22:45 AM: Resolved config
11:22:45 AM: build:
11:22:45 AM: base: /opt/build/repo/ecommercewebsite
11:22:45 AM: command: npm run build
11:22:45 AM: commandOrigin: ui
11:22:45 AM: publish: /opt/build/repo/ecommercewebsite/build
11:22:45 AM: publishOrigin: ui
11:22:46 AM: Caching artifacts
11:22:46 AM: Started saving node modules
11:22:46 AM: Finished saving node modules
11:22:46 AM: Started saving build plugins
11:22:46 AM: Finished saving build plugins
11:22:46 AM: Started saving pip cache
11:22:46 AM: Finished saving pip cache
11:22:46 AM: Started saving emacs cask dependencies
11:22:46 AM: Finished saving emacs cask dependencies
11:22:46 AM: Started saving maven dependencies
11:22:46 AM: Finished saving maven dependencies
11:22:46 AM: Started saving boot dependencies
11:22:46 AM: Finished saving boot dependencies
11:22:46 AM: Started saving rust rustup cache
11:22:46 AM: Finished saving rust rustup cache
11:22:46 AM: Started saving go dependencies
11:22:46 AM: Finished saving go dependencies
11:22:47 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:22:48 AM: Creating deploy upload records
11:22:48 AM: Failing build: Failed to build site
11:22:48 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
11:22:48 AM: Finished processing build request in 1m28.357263017s

Hey @raboomar

This part of the deploy log is showing warnings about unused variables which is reason for the build to fail because as mentioned in the line above this section

The last line I beileve is suggesting Array.prototype.filter() is used but does not return any value.