【问题标题】:AWS CodeBuild not generating build folder - NodeJSAWS CodeBuild 不生成构建文件夹 - NodeJS
【发布时间】:2020-10-14 04:15:26
【问题描述】:

我正在尝试将网站从 Heroku 迁移到 AWS,但在使用 CodeBuild 时遇到了问题。源代码在 GitHub 上,我使用的是 CodePipeline - CodeBuild - Elastic Beanstalk。管道运行良好,似乎代码正在进入 Elastic Beanstalk。但是,我被困在 CodeBuild 步骤。 (buildspec.yml 如下)

日志似乎可以正常运行命令,但是当我将构建输出到 S3 存储桶时,没有构建文件夹。这就是我在使用 Elastic Beanstalk 时遇到的问题……它没有找到构建文件夹来呈现前端。我错过了什么??

buildspec.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

网站使用 MySQL、Express、React、NodeJS 构建

【问题讨论】:

    标签: node.js reactjs amazon-web-services aws-codebuild


    【解决方案1】:

    基于buildspec.yaml reference artifacts 应该是一个数组

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

    artifacts:
      files:
        - '**/*'
    

    【讨论】:

      猜你喜欢
      • 2021-03-12
      • 2020-02-04
      • 1970-01-01
      • 1970-01-01
      • 2020-05-26
      • 2018-12-31
      • 2017-10-29
      • 2018-09-10
      • 1970-01-01
      相关资源
      最近更新 更多