Error during CI

Hello,

When I push my react project I get an error:

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

I tried adding next line in script : $env:CI=“false” but still got the error.

How to do please?

I’m on Windows

Thanks.

Hey @jcouturier, welcome to the GitLab forum :hibiscus:!

Please provide more details about your react project and CI. Are you using GitLab CI? Where are you deploying to, and can you set the parameter as an environment variable?

With more details, someone might be able to offer a suggestion.

Thank you for your answer

I use GitLab CI to deploy the application to a remote Windows machine.

I tried to:

  • add an environment variable CI = false or CI = “” in gitlab environnement variable.
  • add variables CI = false or CI = “” in gitlab-ci.yml
  • add environment = [“CI=”] in config.toml
  • add environment variable in windows directly CI → “”

but nothing works

scripts in package.json

scripts": {
    "startapp": "lerna run start --scope=app",
    "startpdf": "lerna run start --scope=pdfserver",
    "start": "lerna run start",
    "bootstrap": "npx lerna bootstrap --hoist",
    "build": "lerna run build",
    "buildapp": "lerna run build --scope=app",
    "buildpdf": "lerna run build --scope=pdfserver",
    "serveapp": "lerna run serve",
    "publish": "npm run bootstrap && npm run build && npm run serveapp"
  }

and gitlab-ci.yml

stages:
    - build

buildTest:
    stage: build
    tags:
        - app-test
    script:
        - cp -r -fo "packages\app\.env.test" "packages\app\.env"
        - npm run bootstrap
        - npm run build
        - npm run startpdf
    only:
        - dev

Thank you

I found a solution that works.

I use lerna and craco and I added in the package.json on the build command “set CI=false&&”.

"build": "set CI=false&&lerna run build",

it works

1 Like