DEV Community

loading...

Treating warnings as errors because process.env.CI = true.

rabihcigar profile image Roby Cigar Updated on ・1 min read

This error happened everytime I deploy my react code to vercel. I solved this error by put this on build command.

CI=false npm run build
Enter fullscreen mode Exit fullscreen mode

Don't put quotation as a string on env variable -vercel

scripts: {
  "build": "GENERATE_SOURCEMAP=false react-scripts build"
}
Enter fullscreen mode Exit fullscreen mode

There is also a built-in environment variable called NODE_ENV. You can read it from process.env.NODE_ENV. When you run npm start, it is always equal to 'development', when you run npm test it is always equal to 'test', and when you run npm run build to make a production bundle, it is always equal to 'production'. You cannot override NODE_ENV manually. This prevents developers from accidentally deploying a slow development build to production.

Discussion (0)

Forem Open with the Forem app