Failed during stage 'building site': Build script returned non-zero exit code: 2 after pushing changes to master

Hi!

So I’m new to the whole developing world and wanted to try and deploy something with Netlify.

So I was able to deploy my react app without any issues, but after seeing it in the browser I wanted to make some changes. And after pushing my changes to my master branch, the deployments fails with the following log:

7:13:12 PM: Build ready to start
7:13:13 PM: build-image version: 53b83b6bede2920f236b25b6f5a95334320dc849
7:13:13 PM: build-image tag: v3.6.0
7:13:13 PM: buildbot version: a706ec7a557bcc28584843816a376a10c08955ca
7:13:13 PM: Building without cache
7:13:13 PM: Starting to prepare the repo for build
7:13:14 PM: No cached dependencies found. Cloning fresh repo
7:13:14 PM: git clone https://github.com/fridavbg/MetalQuoteGenerator
7:13:18 PM: Preparing Git Reference refs/heads/master
7:13:19 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus 'build/' in the Netlify UI
7:13:19 PM: Starting build script
7:13:19 PM: Installing dependencies
7:13:19 PM: Python version set to 2.7
7:13:21 PM: v12.18.0 is already installed.
7:13:21 PM: Now using node v12.18.0 (npm v6.14.4)
7:13:21 PM: Started restoring cached build plugins
7:13:21 PM: Finished restoring cached build plugins
7:13:21 PM: Attempting ruby version 2.7.1, read from environment
7:13:23 PM: Using ruby version 2.7.1
7:13:23 PM: Using PHP version 5.6
7:13:23 PM: Started restoring cached node modules
7:13:23 PM: Finished restoring cached node modules
7:13:23 PM: Installing NPM modules using NPM version 6.14.4
7:13:53 PM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
7:13:53 PM: > node -e "try{require('./postinstall')}catch(e){}"
7:13:53 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/core-js
7:13:53 PM: > node -e "try{require('./postinstall')}catch(e){}"
7:13:53 PM: > core-js-pure@3.6.5 postinstall /opt/build/repo/node_modules/core-js-pure
7:13:53 PM: > node -e "try{require('./postinstall')}catch(e){}"
7:13:56 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/react-scripts/node_modules/fsevents):
7:13:56 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
7:13:56 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
7:13:56 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
7:13:56 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/chokidar/node_modules/fsevents):
7:13:56 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
7:13:56 PM: added 1653 packages from 808 contributors and audited 1726 packages in 31.946s
7:13:57 PM: 57 packages are looking for funding
7:13:57 PM:   run `npm fund` for details
7:13:57 PM: found 4145 vulnerabilities (4138 low, 7 high)
7:13:57 PM:   run `npm audit fix` to fix them, or `npm audit` for details
7:13:57 PM: NPM modules installed
7:13:58 PM: Started restoring cached go cache
7:13:58 PM: Finished restoring cached go cache
7:13:58 PM: go version go1.14.4 linux/amd64
7:13:58 PM: go version go1.14.4 linux/amd64
7:13:58 PM: Installing missing commands
7:13:58 PM: Verify run directory
7:13:59 PM: ​
7:13:59 PM: ────────────────────────────────────────────────────────────────
7:13:59 PM:   Netlify Build                                                 
7:13:59 PM: ────────────────────────────────────────────────────────────────
7:13:59 PM: ​
7:13:59 PM: ❯ Version
7:13:59 PM:   @netlify/build 8.0.3
7:13:59 PM: ​
7:13:59 PM: ❯ Flags
7:13:59 PM:   deployId: 600089b8d8ba8a2507aa8177
7:13:59 PM:   mode: buildbot
7:13:59 PM: ​
7:13:59 PM: ❯ Current directory
7:13:59 PM:   /opt/build/repo
7:13:59 PM: ​
7:13:59 PM: ❯ Config file
7:13:59 PM:   No config file was defined: using default values.
7:13:59 PM: ​
7:13:59 PM: ❯ Context
7:13:59 PM:   production
7:13:59 PM: ​
7:13:59 PM: ────────────────────────────────────────────────────────────────
7:13:59 PM:   1. Build command from Netlify app                             
7:13:59 PM: ────────────────────────────────────────────────────────────────
7:13:59 PM: ​
7:13:59 PM: $ CI= npm run build
7:14:00 PM: > randomquotemachine@0.1.0 build /opt/build/repo
7:14:00 PM: > react-scripts build
7:14:01 PM: Creating an optimized production build...
7:14:03 PM: Failed to compile.
7:14:03 PM: 
7:14:03 PM: ./src/index.js
7:14:03 PM: Error: [BABEL] /opt/build/repo/src/index.js: Could not find plugin "proposal-class-properties". Ensure there is an entry in ./available-plugins.js for it. (While processing: "/opt/build/repo/node_modules/babel-preset-react-app/index.js$0")
7:14:03 PM:     at Array.map (<anonymous>)
7:14:03 PM:     at Generator.next (<anonymous>)
7:14:03 PM:     at Generator.next (<anonymous>)
7:14:03 PM: npm ERR! code ELIFECYCLE
7:14:03 PM: npm ERR! errno 1
7:14:03 PM: npm ERR! randomquotemachine@0.1.0 build: `react-scripts build`
7:14:03 PM: npm ERR! Exit status 1
7:14:03 PM: npm ERR!
7:14:03 PM: npm ERR! Failed at the randomquotemachine@0.1.0 build script.
7:14:03 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
7:14:03 PM: npm ERR! A complete log of this run can be found in:
7:14:03 PM: npm ERR!     /opt/buildhome/.npm/_logs/2021-01-14T18_14_03_629Z-debug.log
7:14:03 PM: ​
7:14:03 PM: ────────────────────────────────────────────────────────────────
7:14:03 PM:   "build.command" failed                                        
7:14:03 PM: ────────────────────────────────────────────────────────────────
7:14:03 PM: ​
7:14:03 PM:   Error message
7:14:03 PM:   Command failed with exit code 1: CI= npm run build
7:14:03 PM: ​
7:14:03 PM:   Error location
7:14:03 PM:   In Build command from Netlify app:
7:14:03 PM:   CI= npm run build
7:14:03 PM: ​
7:14:03 PM:   Resolved config
7:14:03 PM:   build:
7:14:03 PM:     command: CI= npm run build
7:14:03 PM:     commandOrigin: ui
7:14:03 PM:     publish: /opt/build/repo/build
7:14:03 PM: Caching artifacts
7:14:03 PM: Started saving node modules
7:14:03 PM: Finished saving node modules
7:14:03 PM: Started saving build plugins
7:14:03 PM: Finished saving build plugins
7:14:03 PM: Started saving pip cache
7:14:03 PM: Finished saving pip cache
7:14:03 PM: Started saving emacs cask dependencies
7:14:03 PM: Finished saving emacs cask dependencies
7:14:03 PM: Started saving maven dependencies
7:14:03 PM: Finished saving maven dependencies
7:14:03 PM: Started saving boot dependencies
7:14:03 PM: Finished saving boot dependencies
7:14:03 PM: Started saving rust rustup cache
7:14:03 PM: Finished saving rust rustup cache
7:14:03 PM: Started saving rust cargo bin cache
7:14:03 PM: Finished saving rust cargo bin cache
7:14:03 PM: Started saving go dependencies
7:14:03 PM: Finished saving go dependencies
7:14:06 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:14:06 PM: Failing build: Failed to build site
7:14:06 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
7:14:06 PM: Finished processing build request in 52.987479291s

I have searched for the errors but not able to find any resolved thread. I have tried adding CI= npm run build / CI=true npm run build, but I still get the same deployment failure.
Is anyone able to point me in the right direction ?

hi there, the above is definitely the source of the problem. Can you pinpoint where the problem is originating in that file?