Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent Netlify from treating warnings as errors because process.env.CI = true?

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?

like image 928
Dick Lucas Avatar asked Jun 16 '20 19:06

Dick Lucas


People also ask

How do you fix treating warnings as errors because process ENV CI is real?

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.

How do you make CI false in Netlify?

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.


3 Answers

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.

like image 104
aldobsom Avatar answered Oct 23 '22 19:10

aldobsom


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!

like image 45
kk651 Avatar answered Oct 23 '22 21:10

kk651


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.

like image 22
Dick Lucas Avatar answered Oct 23 '22 19:10

Dick Lucas