You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Azure上部署Nuxt 3(SSR):上传路径咨询

Nuxt3部署到Azure Web App的正确上传路径

你当前的GitHub Actions配置上传了整个项目根目录,但Nuxt3构建完成后,实际需要部署的是.output目录——这个目录包含了编译后的服务端、客户端代码以及所有运行所需的资源,上传整个根目录会包含源码、node_modules等不必要的文件,既浪费空间也可能导致部署问题。

修改后的Upload artifact for deployment job步骤应该如下:

- name: Upload artifact for deployment job
  uses: actions/upload-artifact@v3
  with:
    name: node-app
    path: .output
    if-no-files-found: error

把path从.改为.output,同时建议把if-no-files-found设为error,这样如果构建失败没生成.output目录时能及时报错,避免无效部署。

完整的工作流配置可以参考:

name: Build and deploy Node.js app to Azure Web App
on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Set up Node.js version
        uses: actions/setup-node@v3
        with:
          node-version: '18.x'

      - name: npm install, build
        run: |
          npm install
          npm run build --if-present

      - name: Upload artifact for deployment job
        uses: actions/upload-artifact@v3
        with:
          name: node-app
          path: .output
          if-no-files-found: error

补充说明:部署到Azure Web App时,后续的部署步骤需要确保指向这个上传的.output目录作为部署源,Azure会自动识别Nuxt3的服务端入口文件(.output/server/index.mjs)来启动应用。

内容的提问来源于stack exchange,提问作者Tunji Olakunle

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 23:02:03