如何解决使用特定的节点版本在Azure上进行静态Web App部署
我正在尝试通过Github Actions使用Azure服务部署静态Web应用。
问题是,我需要使用NodeJS运行脚本。我正在使用ESM模块,这些模块在Node v14中可以正常工作。问题是,在构建任务期间,Azure(或github)使用v12.8(我猜是LTS),其中不支持ESM模块。
view-writer-invalid-position-container
我正在尝试使用此步骤指定Node版本:
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"
仍然,构建过程使用12.8。
我在做什么错,我可以使用特定版本吗?
解决方法
文档说受支持的Node版本仅与LTS一样高。目前为12.8。您目前不能将Azure/static-web-apps-deploy@v0.0.1-preview操作与v14.x一起使用。
我通过使用github-actions并将构建推送到Azure存储解决了这个问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。