BUILD ERROR : Command failed with exit code 1: yarn build

Hello community,

Since a week I can’t deploy new version of our app.

The command “yarn build” fail each time without so much information.

Can you see something I may made wrong ?
Thanks a lot !

Here my variables :

Key CYPRESS_RECORD_KEY
Value
ea2ec1ea-edbe-40f0-9300-72

DEBUG
netlify-plugin-cypress,netlify-plugin-cypress:verbose

NODE_VERSION
12.16.2

YARN_VERSION
1.22.4

Here the build log :

9:49:16 AM: Build ready to start
9:49:18 AM: build-image version: 3031d4c9e432fd7016f6279fc9ad706f9205d845
9:49:18 AM: build-image tag: v3.3.17
9:49:18 AM: buildbot version: 1f35b3abd6e2bf5230d8edf68072840fdec1513f
9:49:18 AM: Fetching cached dependencies
9:49:18 AM: Starting to download cache of 438.8MB
9:49:30 AM: Finished downloading cache in 12.322609077s
9:49:30 AM: Starting to extract cache
9:49:50 AM: Finished extracting cache in 19.692798632s
9:49:50 AM: Finished fetching cache in 32.1393264s
9:49:50 AM: Starting to prepare the repo for build
9:49:50 AM: Preparing Git Reference refs/heads/presentation
9:49:52 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus 'build/' in the Netlify UI
9:49:52 AM: Starting build script
9:49:52 AM: Installing dependencies
9:49:52 AM: Python version set to 2.7
9:49:53 AM: Started restoring cached node version
9:49:56 AM: Finished restoring cached node version
9:49:57 AM: v12.16.2 is already installed.
9:49:57 AM: Now using node v12.16.2 (npm v6.14.4)
9:49:57 AM: Started restoring cached build plugins
9:49:57 AM: Finished restoring cached build plugins
9:49:58 AM: Attempting ruby version 2.6.2, read from environment
9:49:59 AM: Using ruby version 2.6.2
9:49:59 AM: Using PHP version 5.6
9:49:59 AM: 5.2 is already installed.
9:50:00 AM: Using Swift version 5.2
9:50:00 AM: Started restoring cached node modules
9:50:00 AM: Finished restoring cached node modules
9:50:00 AM: Started restoring cached yarn cache
9:50:00 AM: Finished restoring cached yarn cache
9:50:00 AM: Installing NPM modules using Yarn version 1.22.4
9:50:01 AM: yarn install v1.22.4
9:50:01 AM: [1/4] Resolving packages...
9:50:02 AM: [2/4] Fetching packages...
9:50:10 AM: warning mini-css-extract-plugin@0.5.0: Invalid bin field for "mini-css-extract-plugin".
9:50:30 AM: info fsevents@2.0.7: The platform "linux" is incompatible with this module.
9:50:30 AM: info "fsevents@2.0.7" is an optional dependency and failed compatibility check. Excluding it from installation.
9:50:30 AM: info fsevents@1.2.13: The platform "linux" is incompatible with this module.
9:50:30 AM: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
9:50:30 AM: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
9:50:30 AM: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
9:50:30 AM: [3/4] Linking dependencies...
9:50:30 AM: warning "antd > rc-picker@1.6.4" has unmet peer dependency "dayjs@^1.8.18".
9:50:30 AM: warning "react-scripts > @typescript-eslint/eslint-plugin@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
9:50:30 AM: warning "react-scripts > @typescript-eslint/parser@1.13.0" has incorrect peer dependency "eslint@^5.0.0".
9:50:30 AM: warning "react-scripts > eslint-config-react-app@5.2.1" has incorrect peer dependency "@typescript-eslint/eslint-plugin@2.x".
9:50:30 AM: warning "react-scripts > eslint-config-react-app@5.2.1" has incorrect peer dependency "@typescript-eslint/parser@2.x".
9:50:30 AM: warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
9:50:30 AM: warning " > @babel/plugin-syntax-top-level-await@7.10.1" has unmet peer dependency "@babel/core@^7.0.0-0".
9:50:30 AM: warning " > @babel/helper-create-regexp-features-plugin@7.10.1" has unmet peer dependency "@babel/core@^7.0.0".
9:50:49 AM: [4/4] Building fresh packages...
9:50:51 AM: Done in 50.24s.
9:50:51 AM: NPM modules installed using Yarn
9:50:51 AM: Started restoring cached go cache
9:50:53 AM: Finished restoring cached go cache
9:50:53 AM: Installing Go version 1.12
9:50:53 AM: unset GOOS;
9:50:53 AM: unset GOARCH;
9:50:53 AM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64';
9:50:53 AM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}";
9:50:53 AM: go version >&2;
9:50:53 AM: export GIMME_ENV='/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env';
9:50:53 AM: go version go1.12 linux/amd64
9:50:53 AM: Installing missing commands
9:50:53 AM: Verify run directory
9:50:54 AM: ​
9:50:54 AM: ┌─────────────────────────────┐
9:50:54 AM: │        Netlify Build        │
9:50:54 AM: └─────────────────────────────┘
9:50:54 AM: ​
9:50:54 AM: ❯ Version
9:50:54 AM:   @netlify/build 2.0.10
9:50:54 AM: ​
9:50:54 AM: ❯ Flags
9:50:54 AM:   deployId: 5ef456fb7914a10008c7bd4b
9:50:54 AM:   mode: buildbot
9:50:54 AM: ​
9:50:54 AM: ❯ Current directory
9:50:54 AM:   /opt/build/repo
9:50:54 AM: ​
9:50:54 AM: ❯ Config file
9:50:54 AM:   No config file was defined: using default values.
9:50:54 AM: ​
9:50:54 AM: ❯ Context
9:50:54 AM:   branch-deploy
9:50:54 AM: ​
9:50:54 AM: ┌────────────────────────────────┐
9:50:54 AM: │ 1. Build command from settings │
9:50:54 AM: └────────────────────────────────┘
9:50:54 AM: ​
9:50:54 AM: $ yarn build
9:50:54 AM: yarn run v1.22.4
9:50:54 AM: $ react-scripts build
9:50:56 AM: (node:1398) [ESLINT_LEGACY_ECMAFEATURES] DeprecationWarning: The 'ecmaFeatures' config file property is deprecated, and has no effect. (found in ".eslintrc")
9:50:56 AM: Creating an optimized production build...
9:52:45 AM: 
9:52:45 AM: Treating warnings as errors because process.env.CI = true.
9:52:45 AM: Most CI servers set it automatically.
9:52:45 AM: 
9:52:45 AM: Failed to compile.
9:52:45 AM: 
9:52:45 AM: ./src/pages/teleconsultation/Patient.jsx
9:52:45 AM:   Line 1:28:    'useState' is defined but never used                                                                                                                                                                                                                                                 no-unused-vars
9:52:45 AM:   Line 126:14:  Assignments to the 'ws' variable from inside React Hook useEffect will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside useEffect  react-hooks/exhaustive-deps
9:52:45 AM: ./src/pages/teleconsultation/User.jsx
9:52:45 AM:   Line 1:28:    'useState' is defined but never used                                                                                                                                                                                                                                                 no-unused-vars
9:52:45 AM:   Line 127:14:  Assignments to the 'ws' variable from inside React Hook useEffect will be lost after each render. To preserve the value over time, store it in a useRef Hook and keep the mutable value in the '.current' property. Otherwise, you can move this variable directly inside useEffect  react-hooks/exhaustive-deps
9:52:46 AM: error Command failed with exit code 1.
9:52:46 AM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
9:52:46 AM: ​
9:52:46 AM: ┌─────────────────────────────┐
9:52:46 AM: │   "build.command" failed    │
9:52:46 AM: └─────────────────────────────┘
9:52:46 AM: ​
9:52:46 AM:   Error message
9:52:46 AM:   Command failed with exit code 1: yarn build
9:52:46 AM: ​
9:52:46 AM:   Error location
9:52:46 AM:   In Build command from settings:
9:52:46 AM:   yarn build
9:52:46 AM: ​
9:52:46 AM:   Resolved config
9:52:46 AM:   build:
9:52:46 AM:     command: yarn build
9:52:46 AM:     publish: /opt/build/repo/build
9:52:46 AM: Caching artifacts
9:52:46 AM: Started saving node modules
9:52:46 AM: Finished saving node modules
9:52:46 AM: Started saving build plugins
9:52:46 AM: Finished saving build plugins
9:52:46 AM: Started saving yarn cache
9:52:46 AM: Finished saving yarn cache
9:52:46 AM: Started saving pip cache
9:52:54 AM: Finished saving pip cache
9:52:54 AM: Started saving emacs cask dependencies
9:52:54 AM: Finished saving emacs cask dependencies
9:52:54 AM: Started saving maven dependencies
9:52:54 AM: Finished saving maven dependencies
9:52:54 AM: Started saving boot dependencies
9:52:54 AM: Finished saving boot dependencies
9:52:54 AM: Started saving go dependencies
9:52:56 AM: Finished saving go dependencies
9:52:56 AM: Error running command: Build script returned non-zero exit code: 1
9:52:56 AM: Failing build: Failed to build site
9:52:56 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
9:52:56 AM: Finished processing build request in 3m38.179255332s

Hi @matcham, the key is in this part of your log: Treating warnings as errors because process.env.CI = true.
CI services no longer deploy if there are warnings. You’ll have to get rid of them.

Thanks for your answer @jcespinoza butt I can’t find where this line process.env.CI = true is writted

hi there, please see this thread:

It works !

Thanks @perry

Hello there, I’m sorry @perry but your post didn’t solve my problem.

Here my problem when I try to deploy a react app from create-react-app in the PJ.

I already re-writte the command line in package.json like the warning say but nothing change…

What should I do ! Thank you !

hmm, can you post your package.json file please?

{

“name”: “cra-todolist”,
“version”: “0.1.0”,
“private”: true,
“dependencies”: {
@testing-library/jest-dom”: “^4.2.4”,
@testing-library/react”: “^9.3.2”,
@testing-library/user-event”: “^7.1.2”,
“classnames”: “^2.2.6”,
“react”: “^16.13.1”,
“react-dom”: “^16.13.1”,
“react-scripts”: “3.4.3”
},
“scripts”: {
“start”: “react-scripts start”,
“build”: “CI= react-scripts build”,
“test”: “react-scripts test”,
“eject”: “react-scripts eject”
},
“eslintConfig”: {
“extends”: “react-app”
},
“browserslist”: {
“production”: [
“>0.2%”,
“not dead”,
“not op_mini all”
],
“development”: [
“last 1 chrome version”,
“last 1 firefox version”,
“last 1 safari version”
]
}
}

hey thib21,

do you have a yarn.lock file in your project? you need one if you are trying to run yarn commands:

Yeah I have one too. I use yarn for development mode so yes I have one yarn.lock file

Do you have a solution then @perry ?

Hi, @Thib21. The error I see in the logs in this:

11:03:10 AM: $ yarn build
11:03:10 AM: yarn run v1.22.4
11:03:10 AM: $ react-scripts build
11:03:11 AM: Creating an optimized production build...
11:03:21 AM: Failed to compile.
11:03:21 AM: 
11:03:21 AM: ./src/components/App/App.scss
11:03:21 AM: To import Sass files, you first need to install node-sass.
11:03:21 AM: Run `npm install node-sass` or `yarn add node-sass` inside your workspace.

The error is occurring because that dependency is missing. Have you tried running yarn add node-sass and then committing those changes?

Ok, it works ! But I had some problems with my _vars.scss files when I use a var in some styles.scss files… But it works. Thank you @luke