Node.js 使用特定节点版本使用Azure部署静态Web应用

Node.js 使用特定节点版本使用Azure部署静态Web应用,node.js,azure,github-actions,Node.js,Azure,Github Actions,我正在尝试使用Azure服务和Github操作部署静态web应用程序 问题是,我需要使用NodeJS运行一个脚本。我使用的ESM模块在节点v14中运行良好。问题是,在构建任务期间,Azure(或github)使用v12.8(我猜是LTS),其中不支持ESM模块 name: Azure Static Web Apps CI/CD on: push: branches: - master pull_request: types: [opened, synchro

我正在尝试使用Azure服务和Github操作部署静态web应用程序

问题是,我需要使用NodeJS运行一个脚本。我使用的ESM模块在节点v14中运行良好。问题是,在构建任务期间,Azure(或github)使用v12.8(我猜是LTS),其中不支持ESM模块

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: 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_LEMON_GLACIER_0C510BD03 }}
          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 you 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
          app_artifact_location: "public" # 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_LEMON_GLACIER_0C510BD03 }}
          action: "close"
我试图使用以下步骤指定节点版本:

- name: Setup Node 14.x
  uses: actions/setup-node@v1
    with:
      node-version: '14.x'
尽管如此,构建过程还是使用了12.8


我做错了什么?在我的情况下是否可以使用特定的版本?

文档中说,受支持的节点版本仅与LTS一样高。12.8目前。您无法使用Azure/静态web应用程序-deploy@v0.0.1-立即使用v14.x预览操作


我通过使用github操作并将构建推送到azure存储解决了这个问题。

文档中说,受支持的节点版本只有LTS那么高。12.8目前。您无法使用Azure/静态web应用程序-deploy@v0.0.1-立即使用v14.x预览操作


我通过使用github操作并将构建推送到azure存储解决了这个问题。

请将日志添加到您的问题中,其中说明它正在使用12.8。根据文档说明,该操作使用Microsoft的build system Oryx,您可能必须对此进行相应的配置。@riQQ我找到了文档,它说is只支持LTS版本,即12.8。v14将在10月份成为LTS。我将结束这个问题。谢谢你抽出时间!请将日志添加到您的问题中,说明它正在使用12.8。根据文档说明,该操作使用Microsoft的build system Oryx,您可能必须对此进行相应的配置。@riQQ我找到了文档,它说is只支持LTS版本,即12.8。v14将在10月份成为LTS。我将结束这个问题。谢谢你抽出时间!