azure static app deployment error due to incompatible node version

javier 901 Reputation points
2021-04-16T21:15:49.533+00:00

I am trying to deploy an static app but when running the github action workflow I get an error. My hypothesis is that the node version used by github is incompatible with other dependencies so I would like to downgrade it from 14.x to 10.x

How do I do that?

Based on some docs (https://github.com/actions/setup-node) I managed to modify the workflow file (without success, still using node 14.x) like this:

name: Azure Static Web Apps CI/CD  
  
on:  
  push:  
    branches:  
      - master  
  pull_request:  
    types: [opened, synchronize, reopened, closed]  
    branches:  
      - master  
  
jobs:  
  build_and_deploy_job:  
    if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')  
    runs-on: ubuntu-latest  
    name: Build and Deploy Job  
    steps:  
      - uses: actions/checkout@v2  
        with:  
          submodules: true  
      - name: Setup node 10  
        uses: actions/setup-node@v1  
        with:  
          node-version: 10.13.0  
      - name: Build And Deploy  
        id: builddeploy  
        uses: Azure/static-web-apps-deploy@v0.0.1-preview  
        with:  
          azure_static_web_apps_api_token: ${<!-- -->{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_THANKFUL_FOREST_089032F10 }}  
          repo_token: ${<!-- -->{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)  
          action: "upload"  
          ###### Repository/Build Configurations - These values can be configured to match your app requirements. ######  
          # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig  
          app_location: "/" # App source code path  
          api_location: "api" # Api source code path - optional  
          output_location: "www" # Built app content directory - optional  
          ###### End of Repository/Build Configurations ######  
  
  close_pull_request_job:  
    if: github.event_name == 'pull_request' && github.event.action == 'closed'  
    runs-on: ubuntu-latest  
    name: Close Pull Request Job  
    steps:  
      - name: Close Pull Request  
        id: closepullrequest  
        uses: Azure/static-web-apps-deploy@v0.0.1-preview  
        with:  
          azure_static_web_apps_api_token: ${<!-- -->{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_THANKFUL_FOREST_089032F10 }}  
          action: "close"  

Help would be much appreciated

Azure App Service Static Web Apps
No comments
{count} votes

Accepted answer
  1. javier 901 Reputation points
    2021-04-17T16:18:33.677+00:00

    The solution was as simple as adding the following to package.json:

    { 
      "engines" : { 
        "node" : "10.x" 
      }
    }
    

1 additional answer

Sort by: Most helpful
  1. Alex Malhão 1 Reputation point
    2021-12-02T20:09:53.43+00:00

    Is there any way to specify the node version to be used in the static app build?

    No comments