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


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:

Settings — Build & deploy — Continuous Deployment — Build settings — Build 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.