If you face the “Treating warnings as errors because process.env.CI = true.” issue no matter where this post will help you solve this issue, you just have to change your build script to solve this issue!
If your console looks like this, you are probably in the same situation as mine!
Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.
Failed to compile.
CI environment variable, short for Continuous Integration, is commonly set in various CI environments like Travis CI and Github Actions, among many others. The ecosystem has largely agreed to use this environment setting to detect when a build is executing in a CI environment instead of a local development environment.
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. You can do this by changing the environment variable directly in hosting or by changing the build command by adding CI=false.
Follow the below-listed steps to fix Treating warnings as errors because process.env.CI = true. Most CI servers set it automatically. error.
On Netlity it is, Project > Settings > Deploys > Build command
On Vercel it is, Project > Settings > Build & Development Settings
CI=false npm run build
or
CI=false yarn build
If you still have the issue please let me know in the comments below!
"build": "set \"CI=false\" && react-scripts build"
That’s it! By following the steps above, you should be able to fix the “Treating warnings as errors because process.env.CI = true.” error. If you have any further questions or suggestions, feel free to leave them in the comments section below.
This website uses cookies.
View Comments
thank yo so much
Thanks for sharing the solution. It worked.
thanks