DEV Community

Discussion on: Treating warnings as errors because process.env.CI = true.

Collapse
 
totorosyd profile image
Phoebe • Edited

agree with you. The author should give a bit more of context.

What he meant is that in your package.json, under "script" > "build". Whatever command build you have, you should add "CI = false" to override the default value which is "CI=TRUE".

For his example:
"build": "npm run build"
New line will be "build": "CI=false npm run build".

My case I have to write like this "build" : "CI=false && craco build". I used Typescript. Not sure if the && symbol needed or not. I dont bother to test actually :)

But if you only change in package.json and deploy vercel, Preview will be successful (Active) but Production still fails.
So, final solution to solve for both Preview and Production is to add environment variable in Project Settings > Environment Variables in Vercel.

Collapse
 
magimart profile image
Magima Felix O

you guys rock CI=false is the best fix
can also add it directly in vercel directly without adding it to a .env file of your project :)

Collapse
 
naziiriah profile image
`Nazir Abubakar

Thank you, for this.