AWS CodeBuild does not work with Yarn Workspaces

本小妞迷上赌 提交于 2019-12-07 14:45:52

问题


I'm using Yarn Workspaces in my repository and also using AWS CodeBuild to build my packages. When build starts, CodeBuild takes 60 seconds to install all packages and I'd want to avoid this time caching node_modules folder.

When I add:

cache:
  paths:
    - 'node_modules/**/*'

to my buildspec file and enable LOCAL_CUSTOM_CACHE, I receive this error:

error An unexpected error occurred: "EEXIST: file already exists, mkdir '/codebuild/output/src637134264/src/git-codecommit.us-east-2.amazonaws.com/v1/repos/MY_REPOSITORY/node_modules/@packages/configs'".

Is there a way to remove this error configuring AWS CodeBuild or Yarn?

My buildspec file:

version: 0.2
phases:
  install:
    commands:
      - npm install -g yarn
      - git config --global credential.helper '!aws codecommit credential-helper $@'
      - git config --global credential.UseHttpPath true
      - yarn
  pre_build:
    commands:
      - git rev-parse HEAD
      - git pull origin master
  build:
    commands:
      - yarn run build
      - yarn run deploy
  post_build:
    commands:
      - echo 'Finished.'
cache:
  paths:
    - 'node_modules/**/*'

Thank you!

Update 1:

The folder /codebuild/output/src637134264/src/git-codecommit.us-east-2.amazonaws.com/v1/repos/MY_REPOSITORY/node_modules/@packages/configs was being attempted to be created by Yarn, with the command - yarn at install phase. This folder is one of my repository packages, called @packages/config. When I run yarn on my computer, Yarn creates folders linking my packages as described here. An example of how my node_modules structure is on my computer:

node_modules/
|-- ...
|-- @packages/
|   |-- configs/
|   |-- myPackageA/
|   |-- myPackageB/
|-- ...

来源:https://stackoverflow.com/questions/55890275/aws-codebuild-does-not-work-with-yarn-workspaces

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