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

部署Nuxt3 SSG项目至AWS Amplify时遇deploy-manifest.json缺失错误

问题

部署Nuxt3 SSG项目到AWS Amplify时触发错误,当前amplify.yml配置如下:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - nvm use 18 && node --version
        - npm install -g pnpm
        - pnpm install
    build:
      commands:
        - pnpm run generate
  artifacts:
    baseDirectory: ".output/public/"
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

部署错误信息:

2024-04-05T08:18:46.618Z [ERROR]: !!! CustomerError: Failed to find the deploy-manifest.json file in the build output. Please verify that it exists within the "baseDirectory" specified in your buildSpec. If it's not there, we will also check the .amplify-hosting directory as a fallback. When using a framework adapter for hosting on Amplify, double-check that the adapter settings are correct.

疑问:如何解决该错误?deploy-manifest.json是否由AWS自动生成?

解决方案

1. 修改amplify.yml的产物目录配置

Nuxt3执行pnpm run generate后,deploy-manifest.json文件会生成在.output根目录下,而非.output/public子目录。当前配置的baseDirectory指向public,导致Amplify无法找到该文件。调整配置如下:

artifacts:
  baseDirectory: ".output"
  files:
    - '**/*'

修改后Amplify能正确读取到deploy-manifest.json,同时也会包含public下的所有静态资源文件。

2. 确认Nuxt项目配置无冲突

检查nuxt.config.ts中是否修改过生成目录配置,默认generate.dir为.output/public,保持默认即可,无需额外调整,确保Nuxt输出结构符合Amplify的识别逻辑。

关于deploy-manifest.json的说明

该文件不是由AWS自动生成的,它是Nuxt3配合Amplify托管适配器(或Amplify自动检测Nuxt框架时)生成的适配文件,用于告知Amplify站点的路由规则、资源映射等关键托管信息。

内容的提问来源于stack exchange,提问作者emilie zawadzki

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 12:52:36