AWS CodeBuild 不生成构建文件夹 - NodeJS

Sco*_*ore 5 amazon-web-services node.js reactjs aws-codebuild

我正在尝试将网站从 Heroku 迁移到 AWS,但在使用 CodeBuild 时遇到了问题。源代码位于 GitHub 上,我正在使用 CodePipeline - CodeBuild - Elastic Beanstalk。管道工作正常,代码似乎正在进入 Elastic Beanstalk。但是,我陷入了 CodeBuild 步骤。(buildspec.yml 如下)

日志似乎运行命令正常,但是当我将构建输出到 S3 存储桶时,没有构建文件夹。这就是我在使用 Elastic Beanstalk 时遇到的问题...它没有找到用于渲染前端的构建文件夹。我缺少什么?

构建规范.yml:

version: 0.2

phases: 
  install:
    commands:
      # Install Node
      - echo Installing Node 12...
      - curl -sL https://deb.nodesource.com/setup_12.x | bash -
      - apt install -y nodejs
  pre_build:
    commands:
      #install dependencies
      - echo Installing dependencies...
      - npm install
  build:
    commands:
      #build
      - echo Building...
      - npm run build
artifacts:
  files:
    "**/*"
  discard-paths: no
  base-directory: client/build
Run Code Online (Sandbox Code Playgroud)

网站是用 MySQL、Express、React、NodeJS 构建的

Mar*_*cin 1

根据buildspec.yaml 参考,应该artifacts是一个数组

因此,我认为您应该将当前files部分更改为:

artifacts:
  files:
    - '**/*'
Run Code Online (Sandbox Code Playgroud)