Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Github Actions fails to compile React build during deployment to Azure Web Apps

The application I’m working on uses React, NodeJS and Express.
I’ve successfully setup an Azure Web Apps and connected it to the application repository on Github, so whenever I commit a change it’ll be deployed at the same time.

But so far the deployment hasn’t been successful.
Whenever the workflow reaches the npm run build stage, it always ends the process (exit code 1) and says "Failed to compile".
I understand that it has something to do with the CI variable and that I need to change it to false, but my attempts have only ended in errors.

Here’s what I’ve tried:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

In React package.json

  "scripts": {
    "build": "CI=false react-scripts build",
  },

Error: ‘CI’ is not recognized as an internal or external command,
operable program or batch file.

I’ve also tried adding env in the workflow.yml file

      - name: npm install, build
        run: |
          npm install
          npm run build --if-present
          env:
            CI: false

Error: "The term ‘env:’ is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

I just started using Azure about 2 weeks ago, so I’m very much a beginner and would appreciate any help!
Thank you!

>Solution :

Not sure about the React part, but the env: section is indented too deep:

      - name: npm install, build
        run: |
          npm install
          npm run build --if-present
        env:
          CI: false
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading