AWS Amplify - NUXT 3 部署

问题描述 投票:0回答:1

我正在尝试使用 SSG 部署 NUXT 3 项目。我遇到部署问题。

我的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.

有什么想法吗? AWS 不应创建文件deploy-manifest.json ?

amazon-web-services nuxt.js aws-amplify nuxtjs3 nuxt3
1个回答
0
投票

我也遇到了这个错误,这是因为最初在同一个 Amplify 应用程序中,我使用

nuxt build
成功构建了 SSR 应用程序。但后来我用
nuxt generate
切换到静态网站,导致了这个错误。

支持者的原话:

“由于 Amplify 检测到此应用程序为 SSR,因此它已将平台更新为 WEB_COMPUTE,这是 Amplify SSR 应用程序的计算引擎。

我可以看到您随后更新了 buildSpec 以部署静态 Nuxt 应用程序,但平台仍配置为 WEB_COMPUTE。此构建在部署期间失败,因为 Amplify 需要 SSR 部署的其他 SSR 相关工件,但由于构建命令生成静态应用程序,这些工件不存在。”

我使用以下 CLI 命令修复了它:

aws amplify update-app --app-id <app-id> --platform WEB --region <region>

希望这有帮助!

© www.soinside.com 2019 - 2024. All rights reserved.