Everything was working a few days ago and now I cant update my site. Errors dont seem to tell me much, unless Im missing something. Anyone know how I can fix this? Its a react project with node backend and it builds locally without errors, but I cant push any new updates
And heres the link to the repo:
Thank you so much!
Hi @imronha,
In the past, Netlify had been mistakenly forgetting to set the CI
environment variable. This got fixed few days ago.
Unfortunately, this changes the behavior of applications created with create-react-app
. As shown in your logs:
7:49:24 PM: Treating warnings as errors because process.env.CI = true.
7:49:24 PM: Most CI servers set it automatically.
This problem can be fixed either:
- By fixing the warnings below that message
- By changing
react-scripts build
to CI= react-scripts build
in your package.json
Please let us know if this solves your problem!
Thank you for the response @ehmicky. It worked! my site is now deployed and everything works like it did before. I’m a pretty new self-taught developer, so would there be a place where I could learn more about what CI environment variables are? Ive googled and read a bit from gitlab, but it seems a little overwhelming. Again, thank you so much!
1 Like
Many libraries have behavior that should be different when run in a local machine compared to inside a CI. That’s because, as opposed to locally, the user is not interacting directly with the terminal. For example, interactive CLI output (progress bars, spinners, etc.) are typically shown differently in CI, or even hidden. This can be pretty important: for example, some libraries run in watch mode locally, but in CI, watch mode would make the build hang forever, so should not be used.
Every CI provider has its own set of environment variables to allow libraries to detect “Am I running inside this specific CI provider?”. For example, Netlify sets the NETLIFY
environment variable. But this makes it hard for libraries to detect “Am I running inside any CI provider?”. Although this is not an official standard (I believe), the CI
environment variables is the de-facto standard way to do this. It is often set to true
, although it is sometimes set to 1
instead.
Netlify was almost the only CI provider missing this variable, which made many libraries behave incorrectly. We fixed this few days ago.
Unfortunately, create-react-app
uses a stricter behavior when CI
is detected, where all warnings become errors (which was your problem). Unsetting CI
by prefixing CI=
is a workaround this specific issue.
If you are interesting into CI-related variables, the following libraries are also worth checking out: env-ci
, ci-info
and ci-parallel-vars
.
Hope that helps!