Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
318 stars 53 forks source link

github action error while use node 20.11.1 #1419

Closed cqh963852 closed 2 months ago

cqh963852 commented 4 months ago

I am building nextjs14 with github action.

with package.json

  "engines": {
    "node": ">=20.9.0"
  },

It give me an error Node version 20.11.1 is not supported. Please use one of the following versions 12, 14, 16, 18. image


after change package to

  "engines": {
    "node": ">=18.12.0"
  },

It still using v20.11.1.

How to use node20 correctly here?

Another question is, If I want to use node 18.x, how should I configure it?


my action config is

name: Azure Static Web Apps CI/CD

on:
  push:
    branches:
      - dev
  pull_request:
    types: [opened, synchronize, reopened, closed]
    branches:
      - dev

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@v3
        with:
          submodules: true
          lfs: false
      - name: Build And Deploy
        id: builddeploy
        uses: Azure/static-web-apps-deploy@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BLACK_DUNE_02C20D003 }}
          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 source code path - optional
          output_location: "" # 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@v1
        with:
          azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BLACK_DUNE_02C20D003 }}
          action: "close"
cqh963852 commented 4 months ago

I have set package.json

  "engines": {
    "node": "18.17.1"
  },

It works

cqh963852 commented 4 months ago

Why does It says Node version 20.11.1 is not supported?

medevod commented 3 months ago

I have set package.json

  "engines": {
    "node": "18.17.1"
  },

It works for me