Can't deploy my react app

i posted my react app to github but when i deploy it from github it’s always build fails
this is the log

11:03:33 PM: Build ready to start
11:03:35 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
11:03:35 PM: build-image tag: v3.4.1
11:03:35 PM: buildbot version: 0a44c930054be748eff0c581d346282fece89cc0
11:03:36 PM: Building without cache
11:03:36 PM: Starting to prepare the repo for build
11:03:36 PM: No cached dependencies found. Cloning fresh repo
11:03:36 PM: git clone https://github.com/wseai/walees.me-react-portfolio
11:03:37 PM: Preparing Git Reference refs/heads/main
11:03:39 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus 'build/' in the Netlify UI
11:03:39 PM: Starting build script
11:03:39 PM: Installing dependencies
11:03:39 PM: Python version set to 2.7
11:03:40 PM: v12.18.0 is already installed.
11:03:41 PM: Now using node v12.18.0 (npm v6.14.4)
11:03:41 PM: Started restoring cached build plugins
11:03:41 PM: Finished restoring cached build plugins
11:03:42 PM: Attempting ruby version 2.7.1, read from environment
11:03:43 PM: Using ruby version 2.7.1
11:03:44 PM: Using PHP version 5.6
11:03:44 PM: 5.2 is already installed.
11:03:44 PM: Using Swift version 5.2
11:03:44 PM: Started restoring cached node modules
11:03:44 PM: Finished restoring cached node modules
11:03:44 PM: Installing NPM modules using NPM version 6.14.4
11:04:27 PM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
11:04:27 PM: > node -e "try{require('./postinstall')}catch(e){}"
11:04:27 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/core-js
11:04:27 PM: > node -e "try{require('./postinstall')}catch(e){}"
11:04:27 PM: > core-js-pure@3.6.5 postinstall /opt/build/repo/node_modules/core-js-pure
11:04:27 PM: > node -e "try{require('./postinstall')}catch(e){}"
11:04:31 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
11:04:31 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:04:31 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
11:04:31 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:04:31 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/jest-haste-map/node_modules/fsevents):
11:04:31 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:04:31 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/fsevents):
11:04:31 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
11:04:31 PM: added 1659 packages from 800 contributors and audited 1663 packages in 45.548s
11:04:33 PM: 75 packages are looking for funding
11:04:33 PM:   run `npm fund` for details
11:04:33 PM: found 1 high severity vulnerability
11:04:33 PM:   run `npm audit fix` to fix them, or `npm audit` for details
11:04:33 PM: NPM modules installed
11:04:33 PM: Started restoring cached go cache
11:04:33 PM: Finished restoring cached go cache
11:04:33 PM: go version go1.14.4 linux/amd64
11:04:33 PM: go version go1.14.4 linux/amd64
11:04:33 PM: Installing missing commands
11:04:33 PM: Verify run directory
11:04:35 PM: ​
11:04:35 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
11:04:35 PM: β”‚        Netlify Build        β”‚
11:04:35 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
11:04:35 PM: ​
11:04:35 PM: ❯ Version
11:04:35 PM:   @netlify/build 5.0.2
11:04:35 PM: ​
11:04:35 PM: ❯ Flags
11:04:35 PM:   deployId: 5f9201b54b81ce12a6ac94cc
11:04:35 PM:   mode: buildbot
11:04:35 PM: ​
11:04:35 PM: ❯ Current directory
11:04:35 PM:   /opt/build/repo
11:04:35 PM: ​
11:04:35 PM: ❯ Config file
11:04:35 PM:   No config file was defined: using default values.
11:04:35 PM: ​
11:04:35 PM: ❯ Context
11:04:35 PM:   production
11:04:35 PM: ​
11:04:35 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
11:04:35 PM: β”‚ 1. Build command from Netlify app β”‚
11:04:35 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
11:04:35 PM: ​
11:04:35 PM: $ npm run build
11:04:35 PM: > walees.me-react-portfolio@0.1.0 build /opt/build/repo
11:04:35 PM: > react-scripts build
11:04:37 PM: Creating an optimized production build...
11:05:12 PM: 
11:05:12 PM: Treating warnings as errors because process.env.CI = true.
11:05:12 PM: Most CI servers set it automatically.
11:05:12 PM: 
11:05:12 PM: Failed to compile.
11:05:12 PM: 
11:05:12 PM: ./src/pages/projects/project.element.js
11:05:12 PM:   Line 1:8:  'styled' is defined but never used  no-unused-vars
11:05:12 PM: ./src/components/form/form.element.js
11:05:12 PM:   Line 1:8:  'styled' is defined but never used  no-unused-vars
11:05:12 PM: npm ERR! code ELIFECYCLE
11:05:12 PM: npm ERR! errno 1
11:05:12 PM: npm ERR! walees.me-react-portfolio@0.1.0 build: `react-scripts build`
11:05:12 PM: npm ERR! Exit status 1
11:05:12 PM: npm ERR!
11:05:12 PM: npm ERR! Failed at the walees.me-react-portfolio@0.1.0 build script.
11:05:12 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
11:05:12 PM: npm ERR! A complete log of this run can be found in:
11:05:12 PM: npm ERR!     /opt/buildhome/.npm/_logs/2020-10-22T22_05_12_605Z-debug.log
11:05:12 PM: ​
11:05:12 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
11:05:12 PM: β”‚   "build.command" failed    β”‚
11:05:12 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
11:05:12 PM: ​
11:05:12 PM:   Error message
11:05:12 PM:   Command failed with exit code 1: npm run build
11:05:12 PM: ​
11:05:12 PM:   Error location
11:05:12 PM:   In Build command from Netlify app:
11:05:12 PM:   npm run build
11:05:12 PM: ​
11:05:12 PM:   Resolved config
11:05:12 PM:   build:
11:05:12 PM:     command: npm run build
11:05:12 PM:     commandOrigin: ui
11:05:12 PM:     publish: /opt/build/repo/build
11:05:12 PM: Caching artifacts
11:05:12 PM: Started saving node modules
11:05:12 PM: Finished saving node modules
11:05:12 PM: Started saving build plugins
11:05:12 PM: Finished saving build plugins
11:05:12 PM: Started saving pip cache
11:05:12 PM: Finished saving pip cache
11:05:12 PM: Started saving emacs cask dependencies
11:05:12 PM: Finished saving emacs cask dependencies
11:05:12 PM: Started saving maven dependencies
11:05:12 PM: Finished saving maven dependencies
11:05:12 PM: Started saving boot dependencies
11:05:12 PM: Finished saving boot dependencies
11:05:12 PM: Started saving go dependencies
11:05:12 PM: Finished saving go dependencies
11:05:15 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:05:15 PM: Failing build: Failed to build site
11:05:16 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
11:05:16 PM: Finished processing build request in 1m40.189834401s

You have an unused var throwing an error.

thanks for the replay

styled is never used is not the problem
it was a typo error instead of

CI= npm run build

i was adding extra space

2 Likes