AWS CodeBuild not generating build folder - NodeJS

杀马特。学长 韩版系。学妹 提交于 2020-07-08 03:45:37

问题


I'm trying to migrate a website from Heroku to AWS and running into trouble with CodeBuild. The source code is on GitHub and I'm using CodePipeline - CodeBuild - Elastic Beanstalk. The Pipeline works fine and it seems like the code is making its way to Elastic Beanstalk. However, I'm stuck at the CodeBuild step. (buildspec.yml is below)

The logs seem to run the commands fine, but when I output the build to an S3 bucket, there is no build folder. And that's the problem I'm having with Elastic Beanstalk...it's not finding the build folder to render the front end. What am I missing??

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

Site is built with MySQL, Express, React, NodeJS


回答1:


based on the buildspec.yaml reference the artifacts should be an array.

Thus, I think you should change your current files section into:

artifacts:
  files:
    - '**/*'


来源:https://stackoverflow.com/questions/62545984/aws-codebuild-not-generating-build-folder-nodejs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!