DEV Community

CHIN SHAN LEE
CHIN SHAN LEE

Posted on • Updated on

[React] Treating warnings as errors because process.env.CI = true.

yarn run v1.22.10
$ react-scripts build
Creating an optimized production build...

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


---End of Oryx build logs---
Oryx has failed to build the solution.
Enter fullscreen mode Exit fullscreen mode

This problem occurs when you push code with warning in console.

To disable this, follow these steps :

  1. go to your package.json
  2. add CI=false into scripts > build like below
{
"scripts": {
    "start": "react-scripts start",
    "build": "CI=false react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
}
Enter fullscreen mode Exit fullscreen mode

Then you can push the code again !
It should be successfully pushed.

Top comments (2)

Collapse
 
jefferson227 profile image
Jefferson Matheus

Simple and effective, just like as I needed. Thanks a lot!

Collapse
 
matthansbello profile image
Matthew Hans-Bello

You just saved my life right now... Thanks for this