Why my app keep failing to deploy?

i keep getting this build command failed error

4:09:11 PM:   "build.command" failed                                        
4:09:11 PM: ────────────────────────────────────────────────────────────────
4:09:11 PM: ​
4:09:11 PM:   Error message
4:09:11 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
4:09:11 PM: ​
4:09:11 PM:   Error location
4:09:11 PM:   In Build command from Netlify app:
4:09:11 PM:   npm run build
4:09:11 PM: ​
4:09:11 PM:   Resolved config
4:09:12 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:09:11 PM:   build:
4:09:11 PM:     command: npm run build
4:09:11 PM:     commandOrigin: ui
4:09:11 PM:     publish: /opt/build/repo/build
4:09:11 PM:     publishOrigin: ui

this is my repo GitHub - alejo9010/pao-ig-landing, this is my first app using tailwind, dunno if theres something else i have to do before, thanks!

@alejo9010 Can you please post the entire failed build log?
It’s impossible to tell what has occurred from only the fragment that you’ve supplied.

I ran your project locally both as the dev server and a build and both worked.

This is the entire error log

4:08:46 PM: build-image version: 1ca34a93198b041e44214013884c57d146a23fed (focal)
4:08:46 PM: build-image tag: v4.16.4
4:08:46 PM: buildbot version: 5d70ebdb976733297fb4c90b41002389a248e2df
4:08:46 PM: Fetching cached dependencies
4:08:46 PM: Failed to fetch cache, continuing with build
4:08:46 PM: Starting to prepare the repo for build
4:08:47 PM: No cached dependencies found. Cloning fresh repo
4:08:47 PM: git clone --filter=blob:none https://github.com/alejo9010/pao-ig-landing
4:08:47 PM: Preparing Git Reference refs/heads/main
4:08:47 PM: Parsing package.json dependencies
4:08:49 PM: Starting build script
4:08:49 PM: Installing dependencies
4:08:49 PM: Python version set to 2.7
4:08:49 PM: v16.19.0 is already installed.
4:08:49 PM: Now using node v16.19.0 (npm v8.19.3)
4:08:49 PM: Enabling Node.js Corepack
4:08:49 PM: Started restoring cached build plugins
4:08:49 PM: Finished restoring cached build plugins
4:08:50 PM: Attempting Ruby version 2.7.2, read from environment
4:08:50 PM: Using Ruby version 2.7.2
4:08:50 PM: Using PHP version 8.0
4:08:50 PM: Started restoring cached corepack dependencies
4:08:50 PM: mv: cannot move '/opt/build/cache/.node/corepack' to '/opt/buildhome/.node/corepack': No such file or directory
4:08:50 PM: Finished restoring cached corepack dependencies
4:08:50 PM: No npm workspaces detected
4:08:50 PM: Started restoring cached node modules
4:08:50 PM: Finished restoring cached node modules
4:08:50 PM: Bypassing sha validation. Running pre & post install scripts
4:08:51 PM: Installing npm packages using npm version 8.19.3
4:08:55 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: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
4:08:55 PM: npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
4:08:55 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:08:57 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
4:09:01 PM: added 1474 packages, and audited 1475 packages in 10s
4:09:01 PM: 231 packages are looking for funding
4:09:01 PM:   run `npm fund` for details
4:09:01 PM: 6 high severity vulnerabilities
4:09:01 PM: To address all issues (including breaking changes), run:
4:09:01 PM:   npm audit fix --force
4:09:01 PM: Run `npm audit` for details.
4:09:01 PM: npm packages installed
4:09:01 PM: Started restoring cached go cache
4:09:01 PM: Finished restoring cached go cache
4:09:01 PM: go version go1.19.5 linux/amd64
4:09:02 PM: Detected 1 framework(s)
4:09:02 PM: "create-react-app" at version "5.0.1"
4:09:02 PM: Installing missing commands
4:09:02 PM: Verify run directory
4:09:02 PM: Section completed: initializing
4:09:03 PM: ​
4:09:03 PM:   Netlify Build                                                 
4:09:03 PM: ────────────────────────────────────────────────────────────────
4:09:03 PM: ​
4:09:03 PM: ❯ Version
4:09:03 PM:   @netlify/build 29.5.1
4:09:03 PM: ​
4:09:03 PM: ❯ Flags
4:09:03 PM:   baseRelDir: true
4:09:03 PM:   buildId: 63d44b6de29180565fad7818
4:09:03 PM:   deployId: 63d44b6de29180565fad781a
4:09:03 PM: ​
4:09:03 PM: ❯ Current directory
4:09:03 PM:   /opt/build/repo
4:09:03 PM: ​
4:09:03 PM: ❯ Config file
4:09:03 PM:   No config file was defined: using default values.
4:09:03 PM: ​
4:09:03 PM: ❯ Context
4:09:03 PM:   production
4:09:03 PM: ​
4:09:03 PM:   1. Build command from Netlify app                             
4:09:03 PM: ────────────────────────────────────────────────────────────────
4:09:03 PM: ​
4:09:03 PM: $ npm run build
4:09:03 PM: > pao@0.1.0 build
4:09:03 PM: > react-scripts build
4:09:04 PM: Creating an optimized production build...
4:09:11 PM: 
4:09:11 PM: Treating warnings as errors because process.env.CI = true.
4:09:11 PM: Most CI servers set it automatically.
4:09:11 PM: 
4:09:11 PM: Failed to compile.
4:09:11 PM: 
4:09:11 PM: [eslint]
4:09:11 PM: src/App.js
4:09:11 PM:   Line 4:8:  'Header' is defined but never used  no-unused-vars
4:09:11 PM: src/pages/Main.jsx
4:09:11 PM:   Line 3:10:   'Link' is defined but never used                                                                                                                                                                                                                                                                                                                                   no-unused-vars
4:09:11 PM:   Line 20:11:  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images                                                                                                                                                                                                                                                          jsx-a11y/alt-text
4:09:11 PM:   Line 34:11:  The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md  jsx-a11y/anchor-is-valid
4:09:11 PM:   Line 37:11:  The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md  jsx-a11y/anchor-is-valid
4:09:11 PM:   Line 40:11:  The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md  jsx-a11y/anchor-is-valid
4:09:11 PM: ​
4:09:11 PM:   "build.command" failed                                        
4:09:11 PM: ────────────────────────────────────────────────────────────────
4:09:11 PM: ​
4:09:11 PM:   Error message
4:09:11 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
4:09:11 PM: ​
4:09:11 PM:   Error location
4:09:11 PM:   In Build command from Netlify app:
4:09:11 PM:   npm run build
4:09:11 PM: ​
4:09:11 PM:   Resolved config
4:09:12 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:09:11 PM:   build:
4:09:11 PM:     command: npm run build
4:09:11 PM:     commandOrigin: ui
4:09:11 PM:     publish: /opt/build/repo/build
4:09:11 PM:     publishOrigin: ui
4:09:12 PM: Caching artifacts
4:09:12 PM: Started saving node modules
4:09:12 PM: Finished saving node modules
4:09:12 PM: Started saving build plugins
4:09:12 PM: Finished saving build plugins
4:09:12 PM: Started saving pip cache
4:09:12 PM: Finished saving pip cache
4:09:12 PM: Started saving emacs cask dependencies
4:09:12 PM: Finished saving emacs cask dependencies
4:09:12 PM: Started saving maven dependencies
4:09:12 PM: Finished saving maven dependencies
4:09:12 PM: Started saving boot dependencies
4:09:12 PM: Finished saving boot dependencies
4:09:12 PM: Started saving rust rustup cache
4:09:12 PM: Finished saving rust rustup cache
4:09:12 PM: Started saving go dependencies
4:09:12 PM: Finished saving go dependencies
4:09:12 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:09:12 PM: Failing build: Failed to build site
4:09:13 PM: Finished processing build request in 26.164s

Your issue is this:

4:09:11 PM: Treating warnings as errors because process.env.CI = true.

As it says, warnings in your build are being treated as errrors.

Your build throws a bunch of warnings about unused variables etc…

4:09:11 PM:   Line 4:8:  'Header' is defined but never used  no-unused-vars
4:09:11 PM: src/pages/Main.jsx
4:09:11 PM:   Line 3:10:   'Link' is defined but never used                                                                                                                                                                                                                                                                                                                                   no-unused-vars
4:09:11 PM:   Line 20:11:  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images                                                                                                                                                                                                                                                          jsx-a11y/alt-text
4:09:11 PM:   Line 34:11:  The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md  jsx-a11y/anchor-is-valid
4:09:11 PM:   Line 37:11:  The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md  jsx-a11y/anchor-is-valid
4:09:11 PM:   Line 40:11:  The href attribute requires a valid value to be accessible. Provide a valid, navigable address as the href value. If you cannot provide a valid href, but still need the element to resemble a link, use a button and change it with appropriate styles. Learn more: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/HEAD/docs/rules/anchor-is-valid.md  jsx-a11y/anchor-is-valid

You could clean all those up, but you probably just want to turn the CI environment variable to false so that it no longer treats warnings as errors that cause the build to fail.

It’s mentioned at the bottom here:

The easiest way would be changing your Build Command from npm run build to CI= npm run build