How to prevent Netlify from treating warnings as errors because process.env.CI = true?

前端 未结 7 1432
长发绾君心
长发绾君心 2021-02-18 23:39

Deploying new projects started failing on Netlify. Checking the logs I see something that was not in the logs on previous successful deploys:

Treating warnings a         


        
相关标签:
7条回答
  • 2021-02-19 00:02

    You need to have CI to be false during your build command.

    Go to: https://app.netlify.com/sites/mysales-krohne/settings/deploys > Build command and change it to:

    CI=false npm run build

    Now, rebuild your deployment. Should be no problem anymore.

    0 讨论(0)
  • 2021-02-19 00:13

    CI='' npm run build

    For more details please check this out HERE

    0 讨论(0)
  • 2021-02-19 00:14

    You should put CI='' npm run build in your build settings.

    See error below: https://docs.netlify.com/configure-builds/troubleshooting-tips/#build-fails-on-warning-message

    But its better to correct the warnings...

    0 讨论(0)
  • 2021-02-19 00:15

    On June 15 2020 Netlify made a configuration change "adding the environment variable CI to build environments, with the value of true." In your Build and Deploy settings on Netlify change your build command to CI= npm run build. This will prevent Netlify from treating warnings as errors. More discussion on this issue can be found in Netlify's forums.

    0 讨论(0)
  • 2021-02-19 00:20

    Simply change the build command to:

    CI= yarn build
    

    or

    CI= npm build
    

    Like the other posts said, it is due to the CI, so any warning will stop the build. The lines above just means, setting the CI variable to nothing, and then start the command yarn build.

    0 讨论(0)
  • 2021-02-19 00:24

    Sometimes even after setting

    CI = yarn build or npm build command

    the build fails.

    In my case, I ran the build command on my local machine and there was an error with an import which was not being displayed in netlify console.

    So If the build is failing then run it once on your local machine this will notify of any errors.

    0 讨论(0)
提交回复
热议问题