How to Fix the Netlify error: "Treating warnings as errors because process.env.CI = true"

Published Jun 15, 2020

Building locally and in Netlify was working fine until I suddenly received this error in the build logs.

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

My builds failed because of this error.

Naturally, we would want to set CI = false based on the given error.

Let’s navigate to our build command:

SettingsBuild & deployContinuous DeploymentBuild settingsBuild command

The build command for my application was:

npm run build

In order to circumvent this issue, we can just set CI to false before our actual build command.

For me, this is what that looked like:

CI=false && npm run build

In some cases, particularly in React applications, you may need to set CI="" instead of false. This is due to the behavior of the older versions of react-scripts.


More CLI Articles