'process.env.CI = true build failed

I have a project written in react-script and during build I got error

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

Failed to compile.

resolve-url-loader: webpack misconfiguration
  webpack or the upstream loader did not supply a source-map

I tried to set up my build script like this "build": "CI=false && react-scripts build" but then I got an error 'CI' is not recognized as an internal or external command, any suggestions what change I need to make?



Solution 1:[1]

Set the environment variable in the script command:

"build": "CI=false react-scripts build"

Solution 2:[2]

Set the environment variable in the script command with cross-env:

https://www.npmjs.com/package/cross-env

"build": "cross-env CI=false react-scripts build"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AmirHossein Beigi
Solution 2 AmirHossein Beigi