Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to deploy react app on aws amplify but keep getting a "Base Directory not specified for artifacts, unable to create build artifact."

My react app is not making it past the build section. I was able to some some of the previous errors, but I am stuck on this one: 2021-10-03T20:15:39.408Z [ERROR]: !!! CustomerError: Base Directory not specified for artifacts, unable to create build artifact..

Error

This are my build settings, the amplify.yml file. Does anyone know how I can fix this error?

version: 1
backend:
  phases:
    build:
      commands:
        - '# Execute Amplify CLI with the helper script'
        - amplifyPush --simple
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - node -v
        - npm run-script build
    baseDirectory: build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
like image 929
lina Avatar asked Nov 02 '25 05:11

lina


1 Answers

This happens cause there is no entry for artifacts, which holds baseDirectory and files, https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.artifacts.

frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - node -v
        - npm run-script build
  artifacts:
    baseDirectory: build
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
like image 92
Luis de Brito Avatar answered Nov 03 '25 23:11

Luis de Brito