0

I want build my react app via Netlify after 2 minutes of building i get this error: Deploy failed for . And then We couldn’t deploy your site. Check out our Build docs for tips on troubleshooting your build, or ask us for debugging advice.

I must say this is first time what i want deploy something. And also it's my first React app so i'm pure beginner. Be patient with me please and also thank you for all help messages down below :)

Here is the log from deploy:

1:33:26 PM: Build ready to start
1:33:32 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
1:33:32 PM: build-image tag: v4.10.1
1:33:32 PM: buildbot version: d6cba5c3bdf3b91d18560394ac53604c4ddc280f
1:33:32 PM: Fetching cached dependencies
1:33:32 PM: Failed to fetch cache, continuing with build
1:33:32 PM: Starting to prepare the repo for build
1:33:32 PM: No cached dependencies found. Cloning fresh repo
1:33:32 PM: git clone https://github.com/BlackratQQ/RenegadePragueGym
1:33:33 PM: Preparing Git Reference refs/heads/master
1:33:34 PM: Parsing package.json dependencies
1:33:35 PM: Starting build script
1:33:35 PM: Installing dependencies
1:33:35 PM: Python version set to 2.7
1:33:35 PM: Downloading and installing node v16.17.0...
1:33:36 PM: Downloading https://nodejs.org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz...
1:33:36 PM: Computing checksum with sha256sum
1:33:36 PM: Checksums matched!
1:33:38 PM: Now using node v16.17.0 (npm v8.15.0)
1:33:38 PM: Started restoring cached build plugins
1:33:38 PM: Finished restoring cached build plugins
1:33:38 PM: Attempting ruby version 2.7.2, read from environment
1:33:39 PM: Using ruby version 2.7.2
1:33:39 PM: Using PHP version 8.0
1:33:39 PM: No npm workspaces detected
1:33:39 PM: Started restoring cached node modules
1:33:39 PM: Finished restoring cached node modules
1:33:40 PM: Installing NPM modules using NPM version 8.15.0
1:33:40 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:33:40 PM: npm WARN config location in the cache, and they are managed by
1:33:40 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:33:40 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:33:40 PM: npm WARN config location in the cache, and they are managed by
1:33:40 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:33:45 PM: 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
1:33:45 PM: npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
1:33:48 PM: npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
1:33:52 PM: added 1467 packages, and audited 1468 packages in 12s
1:33:52 PM: 194 packages are looking for funding
1:33:52 PM:   run `npm fund` for details
1:33:52 PM: 7 high severity vulnerabilities
1:33:52 PM: To address issues that do not require attention, run:
1:33:52 PM:   npm audit fix
1:33:52 PM: To address all issues (including breaking changes), run:
1:33:52 PM:   npm audit fix --force
1:33:52 PM: Run `npm audit` for details.
1:33:52 PM: NPM modules installed
1:33:52 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:33:52 PM: npm WARN config location in the cache, and they are managed by
1:33:52 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:33:52 PM: Started restoring cached go cache
1:33:52 PM: Finished restoring cached go cache
1:33:52 PM: Installing Go version 1.17 (requested 1.17)
1:33:56 PM: unset GOOS;
1:33:56 PM: unset GOARCH;
1:33:56 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.17.linux.amd64';
1:33:56 PM: export PATH="/opt/buildhome/.gimme/versions/go1.17.linux.amd64/bin:${PATH}";
1:33:56 PM: go version >&2;
1:33:56 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.17.linux.amd64.env"
1:33:56 PM: go version go1.17 linux/amd64
1:33:56 PM: Installing missing commands
1:33:56 PM: Verify run directory
1:33:57 PM: ​
1:33:57 PM: ────────────────────────────────────────────────────────────────
1:33:57 PM:   Netlify Build                                                 
1:33:57 PM: ────────────────────────────────────────────────────────────────
1:33:57 PM: ​
1:33:57 PM: ❯ Version
1:33:57 PM:   @netlify/build 27.16.1
1:33:57 PM: ​
1:33:57 PM: ❯ Flags
1:33:57 PM:   baseRelDir: true
1:33:57 PM:   buildId: 630df5869523b04302ece3cb
1:33:57 PM:   deployId: 630df5869523b04302ece3cd
1:33:57 PM: ​
1:33:57 PM: ❯ Current directory
1:33:57 PM:   /opt/build/repo
1:33:57 PM: ​
1:33:57 PM: ❯ Config file
1:33:57 PM:   No config file was defined: using default values.
1:33:57 PM: ​
1:33:57 PM: ❯ Context
1:33:57 PM:   production
1:33:57 PM: ​
1:33:57 PM: ────────────────────────────────────────────────────────────────
1:33:57 PM:   1. Build command from Netlify app                             
1:33:57 PM: ────────────────────────────────────────────────────────────────
1:33:57 PM: ​
1:33:57 PM: $ npm run build
1:33:58 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
1:33:58 PM: npm WARN config location in the cache, and they are managed by
1:33:58 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
1:33:58 PM: > metrix@0.1.0 build
1:33:58 PM: > react-scripts build
1:33:59 PM: Creating an optimized production build...
1:34:09 PM: 
1:34:09 PM: Treating warnings as errors because process.env.CI = true.
1:34:09 PM: Most CI servers set it automatically.
1:34:09 PM: 
1:34:09 PM: Failed to compile.
1:34:09 PM: 
1:34:09 PM: [eslint]
1:34:09 PM: src/components/Athletes/Athletes.js
1:34:09 PM:   Line 22:9:  'onHover' is assigned a value but never used  no-unused-vars
1:34:09 PM: src/components/Contact/Contact.js
1:34:09 PM:   Line 11:3:  'SterboholyWrapper' is defined but never used  no-unused-vars
1:34:09 PM:   Line 12:3:  'ModranyWrapper' is defined but never used     no-unused-vars
1:34:09 PM: src/components/GlobalLink/Link.js
1:34:09 PM:   Line 7:15:  img elements must have an alt prop, either with meaningful text, or an empty string for decorative images  jsx-a11y/alt-text
1:34:09 PM: src/components/Gym/Sterboholy/dataCoachesSterboholy.js
1:34:09 PM:   Line 4:10:  'HeadingH2' is defined but never used     no-unused-vars
1:34:09 PM:   Line 10:8:  'dailyFitness' is defined but never used  no-unused-vars
1:34:09 PM:   Line 11:8:  'vaultFitness' is defined but never used  no-unused-vars
1:34:09 PM:   Line 12:8:  'Video' is defined but never used         no-unused-vars
1:34:09 PM: src/components/Header/Sidebar/styledSidebar.js
1:34:09 PM:   Line 3:18:  'LinkRouter' is defined but never used  no-unused-vars
1:34:09 PM:   Line 5:10:  'green' is defined but never used       no-unused-vars
1:34:09 PM: ​
1:34:09 PM: ────────────────────────────────────────────────────────────────
1:34:09 PM:   "build.command" failed                                        
1:34:09 PM: ────────────────────────────────────────────────────────────────
1:34:09 PM: ​
1:34:09 PM:   Error message
1:34:09 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
1:34:09 PM: ​
1:34:09 PM:   Error location
1:34:09 PM:   In Build command from Netlify app:
1:34:09 PM:   npm run build
1:34:09 PM: ​
1:34:09 PM:   Resolved config
1:34:09 PM:   build:
1:34:09 PM:     command: npm run build
1:34:09 PM:     commandOrigin: ui
1:34:09 PM:     publish: /opt/build/repo/build
1:34:09 PM:     publishOrigin: ui
1:34:09 PM: Caching artifacts
1:34:09 PM: Started saving node modules
1:34:09 PM: Finished saving node modules
1:34:09 PM: Started saving build plugins
1:34:09 PM: Finished saving build plugins
1:34:09 PM: Started saving pip cache
1:34:10 PM: Finished saving pip cache
1:34:10 PM: Started saving emacs cask dependencies
1:34:10 PM: Finished saving emacs cask dependencies
1:34:10 PM: Started saving maven dependencies
1:34:10 PM: Finished saving maven dependencies
1:34:10 PM: Started saving boot dependencies
1:34:10 PM: Finished saving boot dependencies
1:34:10 PM: Started saving rust rustup cache
1:34:10 PM: Finished saving rust rustup cache
1:34:10 PM: Started saving go dependencies
1:34:10 PM: Finished saving go dependencies
1:34:10 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
1:34:11 PM: Creating deploy upload records
1:34:11 PM: Failing build: Failed to build site
1:34:11 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
1:34:11 PM: Finished processing build request in 39.340580069s

1 Answers1

0

This happens when you have warnings and try to build application with

process.env.CI = true

This is defaul true in most Continuous integration systems. If CI is set to true, webpack will treat all warnings as erros.

You have three options

  1. Solve all your warnings (best solution)
  2. Add eslint-ignore tags to your errors
  3. Dislable CI build in env variable
Wraithy
  • 1,722
  • 1
  • 5
  • 13
  • and as i look in that build log, just remove unused variables and fix IMG alt thing and you should be good to go – Wraithy Aug 30 '22 at 12:21
  • I have many warnings to delete but atm i need to show my work to other who are not IT guys. Anyway CI = false works! Ty for help. Btw why Netlify has this logic? Warnings are just warning not errors so i don't under stand why it's set like this – user19571523 Aug 30 '22 at 12:28
  • this logic have nearly every CI, Jenkins, github etc... This is because CI builds are often production builds... and you dont want to have warnings in production :) – Wraithy Aug 30 '22 at 12:36
  • 1
    Alright. make sence. Ty for help buddy :) – user19571523 Aug 30 '22 at 12:39