DEV Community

Cover image for how to deploy react project with warnings on netlify.
Vinay Patil
Vinay Patil

Posted on

how to deploy react project with warnings on netlify.

i was deploying my react page on netlify when I got this error "Build failed due to a user error: Build script returned non-zero exit code: 2"

I saw some warnings related to variable dependencies not being in the useEffect but I didn't want to solve it, so I tried finding a new solution.

and then I saw this:

12:39:50 AM: Treating warnings as errors because process.env.CI = true.
12:39:50 AM: Most CI servers set it automatically.
Enter fullscreen mode Exit fullscreen mode

I thought maybe setting this CI variable to false would solve my problem, and it did so here's the solution for you, if you are suffering from the same.

  • first step is to find deploy settings in your netlify app.

netlify deploy settings auto publishing demo

  • just find deploy settings and scroll down to the environment variables section which looks like this:

netlify environment variables key ci

  • add the new variable CI with the value 'false'.

  • deploy your site again and the error will be solved.

netlify site is live

Top comments (0)