DEV Community

[Solved] “Treating warnings as errors because of process.env.CI = true”

Kapil Pandey on July 23, 2020

Did deploying your code to netlify failed and in logs you are getting Treating warnings as errors because of process.env.CI = true If yes then yo...
Collapse
 
militusinnocent profile image
Militus • Edited

I did CI=false npm run build and it worked :)

Collapse
 
saurabhdaswant profile image
saurabh daswant

yup worked for me too

Collapse
 
baxosh profile image
Bakhodir

Worked for me too

Collapse
 
jmamadeu profile image
João Amadeu

Worked for me too, I tested on Vercel and Netlify.

Collapse
 
adisking1 profile image
Aditya Narayan Sah

Fix

  • Log in to Netlify
  • Choose your app and click on Site settings
  • Navigate to Build & Deploy
  • Under Continuous Deployment select Edit settings
  • Scroll down to Environment variables and add a new Variable with the following values

CI = false

Collapse
 
raymartevangelista profile image
Raymart Evangelista

Worked for me too!

Collapse
 
drahdavid profile image
drahdavid

Thank you so much for the fix and the explanaition. CI=false npm run build worked for me.

Collapse
 
juxnpxblo profile image
juan

ty! worked for me deploying a react app to vercel
just override the build command with CI= npm run build

Collapse
 
nitika1111 profile image
Nitika Sharma

It worked! Thanks :)

Collapse
 
desdamo profile image
desdamo • Edited

Hello. I tried différents write but didn't work with vercel. Can you help me please?

"scripts": {
"start": "craco start",
"build": "CI='' yarn build",
"test": "craco test",

"eject": "react-scripts eject"
Enter fullscreen mode Exit fullscreen mode

},

Collapse
 
kelahkelah profile image
KelahKelah

Thanks. This solved the problem for me.
I used yarn and already had a yarn.lock file so automatically the Build command already had 'yarn build' so all i did was add CI = to the yarn build and it worked.
Like
Build command: CI= yarn build.

But for npm it would be
Build command: CI= npm run build

Collapse
 
militusinnocent profile image
Militus

Hi, I'm almost completely new. I tried CI= npm run build but it didn't work, I guess I'm doing sth wrong. Any ideas on how to fix this on vercel?

Collapse
 
josiasaurel profile image
Josias Aurel • Edited

On vercel and netlify, setting CI to false in environment variables make it work XD

Collapse
 
ahmedsarhan profile image
Ahmed Sarhan

I just signed in to say thank you ... this saved my day

Thread Thread
 
chazkiker2 profile image
Chaz Kiker

retweet

Collapse
 
likelionsungguk profile image
Sungguk Cho

THANKS !!

CI=false npm run build
working in gitlab ci
but in other cases, i think
Ci='' would be good
because sometimes the false string means true not false

reference below
docs.netlify.com/configure-builds/...

Collapse
 
lucasrmagalhaes profile image
Lucas Magalhães

Thanks!! You saved me! I'm happy now. x)
covid19-pwa.netlify.app/

Collapse
 
kapi1 profile image
Kapil Pandey

Glad to be of some help!

Collapse
 
overmartinezglobant profile image
Over Martinez

Hi everyone!
I'm getting an error with CI but with the test commands, I have this in my package.json:

"test": "TZ=UTC razzle test --env=jsdom",
"test:ci": "CI=true yarn test",
Enter fullscreen mode Exit fullscreen mode

When I run on my local machine the command yarn run test it works perfectliy fine on all tests, however when I run yarn run test:ci sometimes it fails 1 or 2 tests sometimes pass all of them, the results are so random.

According to what all of you are saying here, I changed "CI=false ... but still the same

Someone can help me!? 🙏

Collapse
 
justinpatel profile image
Justin Patel

Thanks, worked like a charm for me. 😉

Collapse
 
thangtruong1808 profile image
Thang Truong

Hi Everyone,

CI= npm run build
Enter fullscreen mode Exit fullscreen mode

This worked well.

Thanks

Collapse
 
radidev profile image
Radi-dev

CI=false npm run build worked for me.
Thanks

Collapse
 
nedcode profile image
Ned Marafawi

This actually fixed my issue!! Thank you so much :)

Collapse
 
victoreke profile image
Victor Eke

This just saved me. Thanks Mate!

Collapse
 
ashleynmoon profile image
Ashley Moon

Thank you! So helpful 😊

Collapse
 
sruthiragupathy profile image
sruthiragupathy

Thank you it helped

Collapse
 
eimn profile image
enoralecuyer

Thank you so much!

Collapse
 
pixelagil profile image
Alejandro Vivas

Thank you!!

Collapse
 
elminhoemmanuel profile image
Emmanuel Amodu

Thanks a lot just helped me after days of struggling...wheeww

Collapse
 
robkaa profile image
RobK-AA

Just made an account to thank you for this!

Collapse
 
shivashankar_741 profile image
Shiva shankar

Big thanks to you

Collapse
 
mrsaaddev profile image
mrsaadDev

thankyou!

Collapse
 
angelisreis profile image
angelis-reis

Thanks o lot. Works like a charm, using: CI=false npm run build

Collapse
 
akinncar profile image
Akinn Rosa • Edited

works here on vercel deploy, nice job!

Collapse
 
donvitocodes profile image
donvitocodes • Edited

Thanks! This worked for me. I used this for yarn.

CI=false yarn run build

Collapse
 
sonaljain067 profile image
Sonal Jain

Thank you!

Collapse
 
codebudy5247 profile image
Aditya shekhar

Thanks

Collapse
 
onukwilip profile image
Prince

Wow thanks! I did CI=false npm run build and it worked fine 😁😁. I wish i had known this sooner, i had to commit my node_modules folder to github before i found this solution 😥

Collapse
 
ushashir profile image
Ushahemba Shir

This worked for me

Collapse
 
coderamrin profile image
Amrin

Hey Thanks Kapil.

Collapse
 
ervidaslaven profile image
Slaven Đervida

Thank you so much! Works for me. 😄

Collapse
 
miconley profile image
Michael Conley

Simple workaround but devs should be sure to re-enable this feature prior to launch.

Collapse
 
ukreddyerwin profile image
Uday Kiran Reddy

Where to set this in github actions?

Collapse
 
varvay profile image
Varid Vaya Yusuf • Edited

Hi @kapi1 Im wondering what's the drawback when we disable the CI option? Is this flag only treats warning as error or it serve another purpose?

Collapse
 
nathaliejanep profile image
Nathalie Persson Enriquez

CI= npm run build worked for me:)))))

Collapse
 
saeidatashin profile image
saeidAtashin

perfect