Desh Deepak Dhobi
Desh Deepak Dhobi

Reputation: 357

AWS CodeBuild + CodePipeline: "CLIENT_ERROR Message: no matching base directory path found for dist"

I am trying to build the node app through the AWS CodeBuild service and every time its failing with the same error "CLIENT_ERROR Message: no matching base directory path found for dist"

Upvotes: 0

Views: 54

Answers (1)

Desh Deepak Dhobi
Desh Deepak Dhobi

Reputation: 357

I was able to solve the issue by modifying the buildspec.yml file.

Before the issue buildspec.yml file:

version: 0.2

phases:
  install:
    runtime-versions:
      nodejs: 20.12.2
    commands:
      - npm install -g pnpm # Install pnpm globally

  pre_build:
    commands:
      - echo Installing dependencies
      - pnpm install

  build:
    commands:
      - pnpm run build

artifacts:
  files:
    - '**/*'
  base-directory: dist

Buildspec.yml file that solved the issue:

version: 0.2

phases:
  install:
    runtime-versions:
      nodejs: 20.12.2
    commands:
      - npm install -g pnpm # Install pnpm globally

  pre_build:
    commands:
      - echo Installing dependencies
      - pnpm install

  build:
    commands:
      - export NODE_OPTIONS="--max-old-space-size=4096"
      - pnpm run build

artifacts:
  files:
    - '**/*'
  base-directory: dist

The main issue here was with the Heap Memory issue where the Node.js process tries to allocate more memory than is allowed or available.

Upvotes: 0

Related Questions