Impossible to build my application react ,"build.command" failed

Hello, I am having problems to build my react app

my netlify.toml file:

[build]
  CI="npm run build"

my package.json file:

{
  "name": "XXXX",
  "version": "0.0.2",
  "description": "XXXX",
  "main": "index.js",
  "repository": {
    "type": "git"
  },
  "author": "XXXX",
  "license": "MIT",
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ],
  "dependencies": {
    "@fortawesome/fontawesome-free": "5.15.2",
    "@fortawesome/fontawesome-svg-core": "^1.2.35",
    "@fortawesome/free-solid-svg-icons": "^5.15.3",
    "@fortawesome/react-fontawesome": "^0.1.14",
    "apexcharts": "^3.26.1",
    "axios": "^0.21.1",
    "bootstrap": "4.6.0",
    "classnames": "2.2.6",
    "final-form": "^4.20.2",
    "lodash": "^4.17.21",
    "moment": "^2.29.1",
    "moment-duration-format": "^2.3.2",
    "node-sass": "4.14.1",
    "node-sass-package-importer": "5.3.2",
    "react": "17.0.1",
    "react-apexcharts": "^1.3.9",
    "react-csv": "^2.0.3",
    "react-csv-reader": "^3.3.0",
    "react-date-picker": "^8.1.1",
    "react-dates": "^21.8.0",
    "react-datetime": "3.0.4",
    "react-dom": "17.0.1",
    "react-final-form": "^6.5.2",
    "react-redux": "^7.2.3",
    "react-router-dom": "5.2.0",
    "react-scripts": "4.0.1",
    "react-select": "^4.3.0",
    "react-simple-timefield": "^3.2.3",
    "reactstrap": "8.9.0",
    "redux": "^4.0.5",
    "redux-devtools-extension": "^2.13.9",
    "redux-logger": "^3.0.6",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "gulp": "4.0.2",
    "gulp-append-prepend": "1.0.8"
  },
  "optionalDependencies": {
    "eslint-plugin-flowtype": "5.2.0",
    "jquery": "3.5.1",
    "typescript": "4.1.3"
  }
}

My logs build:

9:52:36 PM: Waiting for other deploys from your team to complete
9:52:42 PM: Build ready to start
9:52:43 PM: build-image version: be42e453d6c8f171cc2f654acc29c0a8b60e6d93
9:52:43 PM: build-image tag: v3.7.1
9:52:43 PM: buildbot version: 789a7cee26176d6fc2c69fc2db6f5d2d121f612a
9:52:44 PM: Fetching cached dependencies
9:52:44 PM: Failed to fetch cache, continuing with build
9:52:44 PM: Starting to prepare the repo for build
9:52:44 PM: No cached dependencies found. Cloning fresh repo
9:52:44 PM: git clone https://github.com/alexandrebouttier/suivimx-webapp
9:52:46 PM: Preparing Git Reference refs/heads/master
9:52:47 PM: Starting build script
9:52:48 PM: Installing dependencies
9:52:48 PM: Python version set to 2.7
9:52:49 PM: v12.18.0 is already installed.
9:52:50 PM: Now using node v12.18.0 (npm v6.14.4)
9:52:50 PM: Started restoring cached build plugins
9:52:50 PM: Finished restoring cached build plugins
9:52:50 PM: Attempting ruby version 2.7.1, read from environment
9:52:51 PM: Using ruby version 2.7.1
9:52:52 PM: Using PHP version 5.6
9:52:52 PM: Started restoring cached yarn cache
9:52:52 PM: Finished restoring cached yarn cache
9:52:52 PM: Installing yarn at version 1.22.4
9:52:52 PM: Installing Yarn!
9:52:52 PM: > Downloading tarball...
9:52:52 PM: [1/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz --> /tmp/yarn.tar.gz.5Tbua22Soa
9:52:52 PM:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
9:52:52 PM:                                  Dload  Upload   Total   Spent    Left  Speed
9:52:52 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
9:52:52 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
9:52:52 PM: 100    79  100    79    0     0    376      0 --:--:-- --:--:-- --:--:--   376
9:52:52 PM: 100    93  100    93    0     0    196      0 --:--:-- --:--:-- --:--:--   196
9:52:52 PM: 100   625  100   625    0     0    848      0 --:--:-- --:--:-- --:--:--   848
9:52:53 PM: 100 1215k  100 1215k    0     0  1135k      0  0:00:01  0:00:01 --:--:-- 1135k
9:52:53 PM: [2/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz.asc --> /tmp/yarn.tar.gz.5Tbua22Soa.asc
9:52:53 PM: 100    83  100    83    0     0   1344      0 --:--:-- --:--:-- --:--:--  1344
9:52:53 PM: 100    83  100    83    0     0   1341      0 --:--:-- --:--:-- --:--:--     0
9:52:53 PM: 100    97  100    97    0     0   1073      0 --:--:-- --:--:-- --:--:--  1073
9:52:53 PM: 100   629  100   629    0     0   5329      0 --:--:-- --:--:-- --:--:--  5329
9:52:53 PM: 100  1028  100  1028    0     0   7846      0 --:--:-- --:--:-- --:--:--  7846
9:52:53 PM: > Verifying integrity...
9:52:53 PM: gpg: Signature made Mon 09 Mar 2020 03:52:13 PM UTC using RSA key ID 69475BAA
9:52:53 PM: gpg: Good signature from "Yarn Packaging <yarn@dan.cx>"
9:52:53 PM: gpg: WARNING: This key is not certified with a trusted signature!
9:52:53 PM: gpg:          There is no indication that the signature belongs to the owner.
9:52:53 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
9:52:53 PM:      Subkey fingerprint: 6D98 490C 6F1A CDDD 448E  4595 4F77 6793 6947 5BAA
9:52:53 PM: > GPG signature looks good
9:52:53 PM: > Extracting to ~/.yarn...
9:52:53 PM: > Adding to $PATH...
9:52:53 PM: > Successfully installed Yarn 1.22.4! Please open another terminal where the `yarn` command will now be available.
9:52:53 PM: Started restoring cached node modules
9:52:53 PM: Finished restoring cached node modules
9:52:54 PM: Installing NPM modules using Yarn version 1.22.4
9:52:54 PM: yarn install v1.22.4
9:52:55 PM: [1/4] Resolving packages...
9:52:55 PM: [2/4] Fetching packages...
9:53:24 PM: info fsevents@2.3.2: The platform "linux" is incompatible with this module.
9:53:24 PM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
9:53:24 PM: info fsevents@1.2.13: The platform "linux" is incompatible with this module.
9:53:24 PM: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
9:53:24 PM: [3/4] Linking dependencies...
9:53:24 PM: warning " > bootstrap@4.6.0" has unmet peer dependency "popper.js@^1.16.1".
9:53:24 PM: warning " > react-csv-reader@3.3.0" has unmet peer dependency "prop-types@^15.7.2".
9:53:24 PM: warning " > react-csv-reader@3.3.0" has incorrect peer dependency "react@^16.13.0".
9:53:24 PM: warning " > react-csv-reader@3.3.0" has incorrect peer dependency "react-dom@^16.13.0".
9:53:24 PM: warning " > react-dates@21.8.0" has unmet peer dependency "@babel/runtime@^7.0.0".
9:53:24 PM: warning " > react-dates@21.8.0" has incorrect peer dependency "react@^0.14 || ^15.5.4 || ^16.1.1".
9:53:24 PM: warning " > react-dates@21.8.0" has incorrect peer dependency "react-dom@^0.14 || ^15.5.4 || ^16.1.1".
9:53:24 PM: warning " > react-dates@21.8.0" has unmet peer dependency "react-with-direction@^1.3.1".
9:53:24 PM: warning "react-dates > airbnb-prop-types@2.16.0" has incorrect peer dependency "react@^0.14 || ^15.0.0 || ^16.0.0-alpha".
9:53:24 PM: warning "react-dates > react-with-direction@1.3.1" has incorrect peer dependency "react@^0.14 || ^15 || ^16".
9:53:24 PM: warning "react-dates > react-with-direction@1.3.1" has incorrect peer dependency "react-dom@^0.14 || ^15 || ^16".
9:53:24 PM: warning "react-dates > react-with-styles@4.2.0" has unmet peer dependency "@babel/runtime@^7.0.0".
9:53:24 PM: warning "react-dates > react-with-styles-interface-css@6.0.0" has unmet peer dependency "@babel/runtime@^7.0.0".
9:53:24 PM: warning " > react-datetime@3.0.4" has incorrect peer dependency "react@^16.5.0".
9:53:24 PM: warning " > react-simple-timefield@3.2.3" has unmet peer dependency "prop-types@^15".
9:53:24 PM: warning " > react-simple-timefield@3.2.3" has incorrect peer dependency "react@^16.0.0".
9:53:24 PM: warning " > react-simple-timefield@3.2.3" has incorrect peer dependency "react-dom@^16.0.0".
9:53:24 PM: warning " > eslint-plugin-flowtype@5.2.0" has unmet peer dependency "eslint@^7.1.0".
9:53:40 PM: [4/4] Building fresh packages...
9:53:44 PM: success Saved lockfile.
9:53:44 PM: Done in 49.65s.
9:53:44 PM: NPM modules installed using Yarn
9:53:44 PM: Started restoring cached go cache
9:53:44 PM: Finished restoring cached go cache
9:53:45 PM: go version go1.14.4 linux/amd64
9:53:45 PM: go version go1.14.4 linux/amd64
9:53:45 PM: Installing missing commands
9:53:45 PM: Verify run directory
9:53:46 PM: ​
9:53:46 PM: ────────────────────────────────────────────────────────────────
9:53:46 PM:   Netlify Build                                                 
9:53:46 PM: ────────────────────────────────────────────────────────────────
9:53:46 PM: ​
9:53:46 PM: ❯ Version
9:53:46 PM:   @netlify/build 11.2.6
9:53:46 PM: ​
9:53:46 PM: ❯ Flags
9:53:46 PM:   deployId: 60871a04b6c07b00b616bbf0
9:53:46 PM: ​
9:53:46 PM: ❯ Current directory
9:53:46 PM:   /opt/build/repo
9:53:46 PM: ​
9:53:46 PM: ❯ Config file
9:53:46 PM:   /opt/build/repo/netlify.toml
9:53:46 PM: ​
9:53:46 PM: ❯ Context
9:53:46 PM:   production
9:53:46 PM: ​
9:53:46 PM: ────────────────────────────────────────────────────────────────
9:53:46 PM:   1. Build command from Netlify app                             
9:53:46 PM: ────────────────────────────────────────────────────────────────
9:53:46 PM: ​
9:53:46 PM: $ yarn build
9:53:47 PM: yarn run v1.22.4
9:53:47 PM: $ react-scripts build
9:53:49 PM: Creating an optimized production build...
9:54:59 PM: 
9:54:59 PM: Treating warnings as errors because process.env.CI = true.
9:54:59 PM: Most CI servers set it automatically.
9:54:59 PM: 
9:54:59 PM: Failed to compile.
9:54:59 PM: 
9:54:59 PM: src/Router.js
9:54:59 PM:   Line 17:1:  Assign arrow function to a variable before exporting as module default  import/no-anonymous-default-export
9:54:59 PM: src/components/CheckVehiculeSelected.jsx
9:54:59 PM:   Line 40:6:  React Hook useEffect has a missing dependency: 'loadVehiculeSelected'. Either include it or remove the dependency array. If 'loadVehiculeSelected' changes too often, find the parent component that defines it and wrap that definition in useCallback  react-hooks/exhaustive-deps
9:54:59 PM:   Line 47:6:  React Hook useEffect has a missing dependency: 'history'. Either include it or remove the dependency array                                                                                                                                               react-hooks/exhaustive-deps
9:54:59 PM: src/components/DataFilterDate.jsx
9:54:59 PM:   Line 44:3:  Duplicate key 'endDate'  no-dupe-keys
9:54:59 PM: src/components/ModalCSVImportData.jsx
9:54:59 PM:   Line 18:10:  'fileInfo' is assigned a value but never used  no-unused-vars
9:54:59 PM: src/components/charts/DepensesChart.jsx
9:54:59 PM:   Line 1:17:  'useState' is defined but never used  no-unused-vars
9:54:59 PM: src/components/charts/SortiesYearChart.jsx
9:54:59 PM:   Line 1:17:  'useState' is defined but never used  no-unused-vars
9:54:59 PM: src/components/hoc/AuthenticatedComponent.jsx
9:54:59 PM:   Line 8:8:  React Hook useEffect has a missing dependency: 'checkAuth'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
9:54:59 PM: src/components/modals/ModalFormDepense.jsx
9:54:59 PM:   Line 13:10:  'map' is defined but never used  no-unused-vars
9:54:59 PM: src/layouts/AppLayout.jsx
9:54:59 PM:   Line 10:24:  'toggleSideBar' is assigned a value but never used  no-unused-vars
9:54:59 PM: src/layouts/Sidebar.jsx
9:54:59 PM:   Line 18:24:  'toggleSideBar' is assigned a value but never used  no-unused-vars
9:54:59 PM: src/layouts/Topbar.jsx
9:54:59 PM:   Line 1:17:   'useState' is defined but never used              no-unused-vars
9:54:59 PM:   Line 29:11:  'showSideBar' is assigned a value but never used  no-unused-vars
9:54:59 PM: src/pages/AddVehiculePage.jsx
9:54:59 PM:   Line 33:6:    React Hook useEffect has a missing dependency: 'getOptionsTypes'. Either include it or remove the dependency array. If 'getOptionsTypes' changes too often, find the parent component that defines it and wrap that definition in useCallback  react-hooks/exhaustive-deps
9:54:59 PM:   Line 170:17:  No duplicate props allowed                                                                                                                                                                                                                     react/jsx-no-duplicate-props
9:54:59 PM: src/pages/DashboardPage.jsx
9:54:59 PM:   Line 51:6:  React Hook useEffect has missing dependencies: 'getHeuresSortiesYear', 'getTotalHeuresSorties', and 'getVehicules'. Either include them or remove the dependency array. If 'getVehicules' changes too often, find the parent component that defines it and wrap that definition in useCallback                                             react-hooks/exhaustive-deps
9:54:59 PM:   Line 60:6:  React Hook useEffect has missing dependencies: 'getDepenses', 'getEntretiens', 'getOptionsTypes', 'getSorties', 'getVehicules', and 'loadVehiculeSelected'. Either include them or remove the dependency array. If 'getOptionsTypes' changes too often, find the parent component that defines it and wrap that definition in useCallback  react-hooks/exhaustive-deps
9:54:59 PM: src/pages/DepensesPage.jsx
9:54:59 PM:   Line 45:27:  'setOptionsDepenses' is assigned a value but never used                                                                                                                                                                                                                                 no-unused-vars
9:54:59 PM:   Line 62:6:   React Hook useEffect has missing dependencies: 'getDepenses', 'getOptionsTypes', and 'vehiculeSelected'. Either include them or remove the dependency array. If 'getOptionsTypes' changes too often, find the parent component that defines it and wrap that definition in useCallback  react-hooks/exhaustive-deps
9:54:59 PM:   Line 84:6:   React Hook useEffect has a missing dependency: 'depenses'. Either include it or remove the dependency array. If 'setData' needs the current value of 'depenses', you can also switch to useReducer instead of useState and read 'depenses' in the reducer                               react-hooks/exhaustive-deps
9:54:59 PM: src/pages/MyEntretiensPage.jsx
9:54:59 PM:   Line 55:6:  React Hook useEffect has missing dependencies: 'getEntretiens', 'getOptionsEntretiens', and 'getOptionsTypes'. Either include them or remove the dependency array. If 'getOptionsEntretiens' changes too often, find the parent component that defines it and wrap that definition in useCallback  react-hooks/exhaustive-deps
9:54:59 PM:   Line 91:6:  React Hook useEffect has a missing dependency: 'entretiens'. Either include it or remove the dependency array. If 'setData' needs the current value of 'entretiens', you can also switch to useReducer instead of useState and read 'entretiens' in the reducer                                    react-hooks/exhaustive-deps
9:54:59 PM: src/pages/MyVehiculesPage.jsx
9:54:59 PM:   Line 44:6:  React Hook useEffect has a missing dependency: 'getVehicules'. Either include it or remove the dependency array. If 'getVehicules' changes too often, find the parent component that defines it and wrap that definition in useCallback  react-hooks/exhaustive-deps
9:54:59 PM: src/pages/PlanEntretienPage.jsx
9:54:59 PM:   Line 17:6:  React Hook useEffect has a missing dependency: 'getOptionsEntretiens'. Either include it or remove the dependency array. If 'getOptionsEntretiens' changes too often, find the parent component that defines it and wrap that definition in useCallback  react-hooks/exhaustive-deps
9:54:59 PM: src/pages/SortiesPage.jsx
9:54:59 PM:   Line 52:6:  React Hook useEffect has missing dependencies: 'getOptionsTypes' and 'getSorties'. Either include them or remove the dependency array. If 'getOptionsTypes' changes too often, find the parent component that defines it and wrap that definition in useCallback  react-hooks/exhaustive-deps
9:54:59 PM: src/pages/auth/LoginPage.jsx
9:54:59 PM:   Line 1:17:  'useState' is defined but never used  no-unused-vars
9:54:59 PM: src/store/configureStore.js
9:54:59 PM:   Line 18:1:  Assign arrow function to a variable before exporting as module default  import/no-anonymous-default-export
9:54:59 PM: src/store/modules/auth.js
9:54:59 PM:   Line 20:1:  Unexpected default export of anonymous function  import/no-anonymous-default-export
9:54:59 PM: src/store/modules/depenses.js
9:54:59 PM:   Line 23:1:  Unexpected default export of anonymous function  import/no-anonymous-default-export
9:54:59 PM:   Line 37:5:  Duplicate case label                             no-duplicate-case
9:54:59 PM: src/store/modules/entretiens.js
9:54:59 PM:   Line 23:1:  Unexpected default export of anonymous function  import/no-anonymous-default-export
9:54:59 PM: src/store/modules/optionsEntretiens.js
9:54:59 PM:   Line 15:1:  Unexpected default export of anonymous function  import/no-anonymous-default-export
9:54:59 PM: src/store/modules/optionsTypes.js
9:54:59 PM:   Line 15:1:  Unexpected default export of anonymous function  import/no-anonymous-default-export
9:54:59 PM: src/store/modules/sorties.js
9:54:59 PM:   Line 39:1:  Unexpected default export of anonymous function  import/no-anonymous-default-export
9:54:59 PM: src/store/modules/vehicules.js
9:54:59 PM:   Line 29:1:  Unexpected default export of anonymous function  import/no-anonymous-default-export
9:54:59 PM: error Command failed with exit code 1.
9:54:59 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
9:54:59 PM: ​
9:54:59 PM: ────────────────────────────────────────────────────────────────
9:54:59 PM:   "build.command" failed                                        
9:54:59 PM: ────────────────────────────────────────────────────────────────
9:54:59 PM: ​
9:54:59 PM:   Error message
9:54:59 PM:   Command failed with exit code 1: yarn build
9:54:59 PM: ​
9:54:59 PM:   Error location
9:54:59 PM:   In Build command from Netlify app:
9:54:59 PM:   yarn build
9:54:59 PM: ​
9:54:59 PM:   Resolved config
9:54:59 PM:   build:
9:54:59 PM:     command: yarn build
9:54:59 PM:     commandOrigin: ui
9:54:59 PM:     publish: /opt/build/repo/build
9:54:59 PM: Caching artifacts
9:54:59 PM: Started saving node modules
9:54:59 PM: Finished saving node modules
9:54:59 PM: Started saving build plugins
9:54:59 PM: Finished saving build plugins
9:54:59 PM: Started saving yarn cache
9:54:59 PM: Finished saving yarn cache
9:54:59 PM: Started saving pip cache
9:55:00 PM: Finished saving pip cache
9:55:00 PM: Started saving emacs cask dependencies
9:55:00 PM: Finished saving emacs cask dependencies
9:55:00 PM: Started saving maven dependencies
9:55:00 PM: Finished saving maven dependencies
9:55:00 PM: Started saving boot dependencies
9:55:00 PM: Finished saving boot dependencies
9:55:00 PM: Started saving rust rustup cache
9:55:00 PM: Finished saving rust rustup cache
9:55:00 PM: Started saving go dependencies
9:55:00 PM: Finished saving go dependencies
9:55:02 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:55:03 PM: Creating deploy upload records
9:55:03 PM: Failing build: Failed to build site
9:55:03 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
9:55:03 PM: Finished processing build request in 2m19.193055553s

Hey there, @alex35

Welcome to the Netlify Forums :netliconfetti: This Debugging Support Guide is a good first place to start. Please read through this and follow some of the suggestions. This Support Guide on Frequently Encountered Problems is also applicable!

Please follow the suggestions in those two guides. If you are still having issues after doing that, please respond to this thread with:

  1. Your Netlify site name
  2. Your build log (like you did above :slight_smile: )
  3. What debugging steps you have taken

The build command is CI= npm run build. In your config file, it would look like this:

[build]
  command = "CI= npm run build"
2 Likes

thank you very much that to work

1 Like