【发布时间】:2019-09-17 07:20:10
【问题描述】:
我在我的存储库中使用 Yarn Workspaces,并且还使用 AWS CodeBuild 来构建我的包。构建开始时,CodeBuild 需要 60 秒来安装所有包,我想避免这次缓存 node_modules 文件夹。
当我添加时:
cache:
paths:
- 'node_modules/**/*'
到我的buildspec 文件并启用LOCAL_CUSTOM_CACHE,我收到此错误:
错误发生意外错误:“EEXIST:文件已存在,mkdir'/codebuild/output/src637134264/src/git-codecommit.us-east-2.amazonaws.com/v1/repos/MY_REPOSITORY/node_modules/@包/配置”。
有没有办法消除配置 AWS CodeBuild 或 Yarn 时出现的错误?
我的构建规范文件:
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/**/*'
谢谢!
更新 1:
Yarn 正在尝试创建文件夹/codebuild/output/src637134264/src/git-codecommit.us-east-2.amazonaws.com/v1/repos/MY_REPOSITORY/node_modules/@packages/configs,在install 阶段使用命令- yarn。该文件夹是我的存储库包之一,名为@packages/config。当我在我的计算机上运行yarn 时,Yarn 会创建链接我的包的文件夹,如here 所述。我的node_modules 结构在我的计算机上的示例:
node_modules/
|-- ...
|-- @packages/
| |-- configs/
| |-- myPackageA/
| |-- myPackageB/
|-- ...
【问题讨论】:
-
感谢您报告问题。我们来看看。您的构建逻辑或 CodeBuild 是否尝试了 mkdir? (我假设这是基于您的构建规范的 CodeBuild)。
-
@SubinMathew 感谢您的回复。安装阶段的命令
- yarn尝试创建该文件夹,这是我的软件包之一。我已经更新了我的答案,提供了更多详细信息。 -
我们进行了一些改进以保持文件路径隐式静态。您能否再试一次,如果您遇到同样的问题,请告诉我们?
-
@SubinMathew 我尝试使用相同的配置运行 CodeBuild,但收到相同的错误:` 错误:EEXIST:文件已存在,mkdir '/codebuild/output/src046905303/src/ git-codecommit.us-east-1.amazonaws.com/v1/repos/MY_REPOSITORY/node_modules/@packages/appsync-backend'`。我需要更改一些配置吗?
-
@PedroArantes 你解决了这个问题吗?我遇到了同样的错误。
标签: yarnpkg aws-codebuild yarn-workspaces