Deploying new projects started failing on Netlify. Checking the logs I see something that was not in the logs on previous successful deploys:
Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.
Failed to compile.
How can I fix my build?
In order to fix “Treating warnings as errors because process.env.CI = true.” This error simply means the CI environment variable is set to true. That is why warnings behave like errors. You just have to set the CI environment variable to false, that is all you need to do.
If there is not a netlify. toml file in the project, the build settings can be handled directly in Netlify. By navigating to Settings — Build & Deploy — Continuous Deployment — Build Settings, you can update the build command to set CI=false for each build.
You need to have CI to be false during your build command.
Go to: https://app.netlify.com/sites/mysales-krohne/settings/deploys > Build command and change it to:
CI=false npm run build
Now, rebuild your deployment. Should be no problem anymore.
Here is how I solved:
Once your deployment is failed, go to Deploys -> Deployment Settings.
There you will see Environment tab. Then click Environment Variables -> Edit Variables
Key: CI Value: False
Redeploy with clearing cache. Hopefully it will help!
On June 15 2020 Netlify made a configuration change "adding the environment variable CI to build environments, with the value of true." In your Build and Deploy settings on Netlify change your build command to CI= npm run build
. This will prevent Netlify from treating warnings as errors. More discussion on this issue can be found in Netlify's forums.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With