Netlify Deploy Treating Warnings as Errors

Netlify Deploy Treating Warnings as Errors

If you’re like me, you were minding your own business and deploying your latest feature to staging. And if you’re even more like me, you’re not in the habit or monitoring every single deploy but your pipeline just works.

Until it doesn’t.

This morning’s deploy came to a grinding halt with the following error:

Treating warnings as errors because process.env.CI = true.
Brooklyn 99 — Oh, cool

Luckily, for as daunting as the error may seem, there’s a pretty straight forward fix to it.

process.env.CI = true

Let’s set that to false and carry on like the wayward children we are.

How to Fix

There are two ways this error may be fixed and it depends on your build setup.

Netlify.toml

If the build command for your project is handled in the .toml file, then the fix can be made there as well by manually setting CI to false inside of our build command.

Note, that the .toml file takes precedence over the build settings stored in Netlify.

[build]
command = "CI=false && yarn build"
publish = "build"

Netlify Build Settings

If there is not a netlify.toml file in the project, the build settings can be handled directly in Netlify. By navigating to SettingsBuild & DeployContinuous Deployment — Build Settings, you can update the build command to set CI=false for each build.

Netlify build settings

One caveat, in the event that adding CI=false to the build command still doesn’t work, trying setting CI="" because older versions of react-scripts behave differently and may require an empty string. More information can be found in this thread: https://github.community/t/treating-warnings-as-errors-because-process-env-ci-true/18032

I live my life one hot chocolate at a time.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The VeChain Stats Version 2.0 Beta Release!

Façade Design Pattern in Swift, and Its Important Use-Cases

Introduction to Kubernetes Clusters

RedPrairie/JDA WMS — MSQL explained with examples

JOURNEY SOLID PRINCIPLE ON PHP (part 2)

Flutter vs Reactjs: Which One to Choose in 2022?

Getting started with Azure DevOps

Orchestration in the world of MicroServices

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Daniel Yuschick

Daniel Yuschick

I live my life one hot chocolate at a time.

More from Medium

Dropdown problem with using UI Scaling

LinguiJS: Managing message catalogs across multiple application instances

My experience with creating a Solid application

Solid

Dawn of Applications (ReactJs🤯)