Netlify failing to build and deploy react app

Hi,

I’m struggling to get this simple react app up and running correctly.

I’ve tried everything, deploying from GH, Netlify CI and build drag and drop files.

Nothing seems to be working, I’ve checked all deploy settings I believe it’s running from the correct dir, and I’ve tried running with run build and npm start but still with no luck.

Please someone help, I’m pulling my hair out!!!

4:44:43 PM: build-image version: 340a5296c836ef3d99ac1d871c6447bb7a417c33 (focal)
4:44:43 PM: buildbot version: 20d735efc756356fd09bbc43982bef2018461b10
4:44:43 PM: Building without cache
4:44:43 PM: Starting to prepare the repo for build
4:44:43 PM: No cached dependencies found. Cloning fresh repo
4:44:43 PM: git clone --filter=blob:none GitHub - CBelloxxi/gericht-restaurant: This is the Gericht Restaurant Landing Page built with a Modern UI/UX using React JS. It encompasses all modern UX Practices, follows a stringent and well organised File Structure and uses React Functional components to create a reusable SubHeading component, which has been used multiple times in the project.
4:44:43 PM: Preparing Git Reference refs/heads/main
4:44:44 PM: Parsing package.json dependencies
4:44:46 PM: Starting to install dependencies
4:44:46 PM: Python version set to 3.8
4:44:46 PM: Attempting Ruby version 2.7.2, read from environment
4:44:46 PM: Using Ruby version 2.7.2
4:44:47 PM: Started restoring cached go cache
4:44:47 PM: Finished restoring cached go cache
4:44:47 PM: Installing Go version 1.19.5 (requested 1.19.5)
4:44:52 PM: go version go1.19.5 linux/amd64
4:44:52 PM: Using PHP version 8.0
4:44:53 PM: v16.20.0 is already installed.
4:44:54 PM: Now using node v16.20.0 (npm v8.19.4)
4:44:54 PM: Enabling Node.js Corepack
4:44:54 PM: Started restoring cached build plugins
4:44:54 PM: Finished restoring cached build plugins
4:44:54 PM: Started restoring cached corepack dependencies
4:44:54 PM: Finished restoring cached corepack dependencies
4:44:54 PM: jq: error (at :75): Cannot iterate over null (null)
4:44:54 PM: No npm workspaces detected
4:44:54 PM: Started restoring cached node modules
4:44:54 PM: Finished restoring cached node modules
4:44:54 PM: Installing npm packages using npm version 8.19.4
4:44:58 PM: npm WARN deprecated w3c-hr-time@1.0.2: Use your platform’s native performance.now() and performance.timeOrigin.npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: Array.prototype.sort() - JavaScript | MDN
4:44:58 PM: npm WARN deprecated sourcemap-codec@1.4.8: Please use jridgewell/sourcemap-codec instead
4:44:58 PM: npm WARN deprecated rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
4:45:01 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
4:45:06 PM: added 1485 packages, and audited 1486 packages in 12s
4:45:06 PM: 235 packages are looking for funding
4:45:06 PM: run npm fund for details
4:45:06 PM: 6 high severity vulnerabilities
4:45:06 PM: To address all issues (including breaking changes), run:
4:45:06 PM: npm audit fix --force
4:45:06 PM: Run npm audit for details.
4:45:06 PM: npm packages installed
4:45:06 PM: Install dependencies script success
4:45:06 PM: Starting build script
4:45:07 PM: Detected 1 framework(s)
4:45:07 PM: “create-react-app” at version “5.0.1”
4:45:07 PM: Section completed: initializing
4:45:09 PM: ​
4:45:09 PM: Netlify Build
4:45:09 PM: ────────────────────────────────────────────────────────────────
4:45:09 PM: ​
4:45:09 PM: ❯ Version
4:45:09 PM: @netlify/build 29.11.2
4:45:09 PM: ​
4:45:09 PM: ❯ Flags
4:45:09 PM: baseRelDir: true
4:45:09 PM: buildId: 645e5ee61fab3e0072b6ad81
4:45:09 PM: deployId: 645e5ee61fab3e0072b6ad83
4:45:09 PM: ​
4:45:09 PM: ❯ Current directory
4:45:09 PM: /opt/build/repo
4:45:09 PM: ​
4:45:09 PM: ❯ Config file
4:45:09 PM: No config file was defined: using default values.
4:45:09 PM: ​
4:45:09 PM: ❯ Context
4:45:09 PM: production
4:45:09 PM: ​
4:45:09 PM: Build command from Netlify app
4:45:09 PM: ────────────────────────────────────────────────────────────────
4:45:09 PM: ​
4:45:09 PM: $ npm run build
4:45:09 PM: > gericht_restaurant@0.1.0 build
4:45:09 PM: > react-scripts build
4:45:10 PM: Creating an optimized production build…
4:45:29 PM:
4:45:29 PM: Treating warnings as errors because process.env.CI = true.
4:45:29 PM: Most CI servers set it automatically.
4:45:29 PM:
4:45:29 PM: Failed to compile.
4:45:29 PM:
4:45:29 PM: [eslint]
4:45:29 PM: src/components/Navbar/Navbar.jsx
4:45:29 PM: Line 1:17: ‘useState’ is defined but never used no-unused-vars
4:45:29 PM: src/constants/data.js
4:45:29 PM: Line 82:1: Assign object to a variable before exporting as module default import/no-anonymous-default-export
4:45:29 PM: src/constants/images.js
4:45:29 PM: Line 24:1: Assign object to a variable before exporting as module default import/no-anonymous-default-export
4:45:29 PM: src/container/Intro/Intro.jsx
4:45:29 PM: Line 1:17: ‘useState’ is defined but never used no-unused-vars
4:45:29 PM: ​
4:45:29 PM: “build.command” failed
4:45:29 PM: ────────────────────────────────────────────────────────────────
4:45:29 PM: ​
4:45:29 PM: Error message
4:45:29 PM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
4:45:29 PM: ​
4:45:29 PM: Error location
4:45:29 PM: In Build command from Netlify app:
4:45:29 PM: npm run build
4:45:29 PM: ​
4:45:29 PM: Resolved config
4:45:29 PM: build:
4:45:29 PM: command: npm run build
4:45:29 PM: commandOrigin: ui
4:45:29 PM: publish: /opt/build/repo/build
4:45:29 PM: publishOrigin: ui
4:45:30 PM: Caching artifacts
4:45:31 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)
4:45:30 PM: Started saving node modules
4:45:30 PM: Finished saving node modules
4:45:30 PM: Started saving build plugins
4:45:30 PM: Finished saving build plugins
4:45:30 PM: Started saving corepack cache
4:45:30 PM: Finished saving corepack cache
4:45:30 PM: Started saving pip cache
4:45:30 PM: Finished saving pip cache
4:45:30 PM: Started saving emacs cask dependencies
4:45:30 PM: Finished saving emacs cask dependencies
4:45:30 PM: Started saving maven dependencies
4:45:30 PM: Finished saving maven dependencies
4:45:30 PM: Started saving boot dependencies
4:45:30 PM: Finished saving boot dependencies
4:45:30 PM: Started saving rust rustup cache
4:45:30 PM: Finished saving rust rustup cache
4:45:30 PM: Started saving go dependencies
4:45:30 PM: Finished saving go dependencies
4:45:31 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:45:31 PM: Failing build: Failed to build site
4:45:31 PM: Finished processing build request in 48.428s

Hiya @CBelloxxi

Please start out by running through the debugging guide and let us know what you find out:

I see some capital letters in your filenames, so at a guess this is around that, which is explained in a bit more detail here: [Support Guide] Debugging Netlify site builds

Awesome thank you, managed to figure it out.

Netlify CI recognises warnings as errors and I had to create a .env file with CI=false add the env var to env variables and redeploy, it worked!

Thanks again