Fix guides / Netlify: "Treating warnings as errors because process.env.CI = true"

How to fix "Treating warnings as errors because process.env.CI = true" on Netlify

Your Netlify deploy log ends with Treating warnings as errors because process.env.CI = true. Most CI servers don't support this; and then Command failed with exit code 1. The code compiles. A linter is failing the build over warnings such as unused variables.

Why it only fails in the cloud

Netlify, Vercel, and most CI hosts set CI=true. Create React App's build script (and some ESLint configs) promote warnings to errors when that variable is set. Locally CI is not set, so the same warnings scroll past harmlessly.

Fix 1 (best): fix the warnings

Scroll up in the deploy log to the list of warnings. They are usually quick: remove an unused import, add a missing dependency to a useEffect array, add alt text to an image. Run CI=true npm run build locally to reproduce exactly what Netlify sees.

Fix 2: stop treating warnings as errors

Change the build command in Site configuration, Build and deploy, Build settings to:

CI= npm run build

Or put it in netlify.toml:

[build]
  command = "CI= npm run build"
  publish = "build"

For Vite projects the publish folder is dist. Setting an environment variable CI to false in the Netlify UI also works.

If the error is different

Command failed with exit code 1 on its own is generic. Read the lines above it: Module not found means a missing package or wrong file name casing, Type error means TypeScript, and JavaScript heap out of memory needs NODE_OPTIONS=--max_old_space_size=4096. Also check that the Node version matches your local one by setting NODE_VERSION.

Check the fix

  1. Trigger a deploy with Clear cache and deploy site.
  2. The log ends with Site is live.
Still stuck? No shame in it: these bugs hide in settings your AI builder cannot see. Send us the error and your repo and we will fix it as a pull request within 24 hours, explained in plain English, for $49. Several things broken? The $149 Full Rescue covers up to 3 issues plus a security pass, within 72 hours. Not fixed means full refund.
Quick Fix, $49Full Rescue, $149Ask first

Last updated 2026-10-19.