【发布时间】:2021-03-20 13:53:07
【问题描述】:
我正在运行我的 buildspec.yml,在 npm run build 命令之后它应该在根路径中创建构建目录,但是,codebuild 无法找到构建目录。我已经从资源中尝试了所有可能的方法,但我仍然我无法解决“找不到匹配的构建基目录路径”
PS:我使用 codecommit 作为源代码,使用 codebuild & codepipeline 来运行部署步骤,并使用 S3 存储桶来部署构建目录。
我的 buildspec.yml
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
pre_build:
commands:
- echo Installing dependencies...
- npm cache clean --force
- npm install
- npm --version
build:
commands:
- aws s3 rm s3://bucketname --recursive
post_build:
commands:
- pwd
- cd src
- npm run build
- ls -la
- aws s3 sync build s3://bucketname
artifacts:
files:
- "**/*"
【问题讨论】:
-
您可以使用一个 S3 命令来满足您的要求
aws s3 sync ./build/ s3://bucketname/ --delete没有更多的调试/日志或脚本失败的地方,我只能猜测是这一行cd src导致了您的问题。 -
@GeorgeRushby 是的,
cd src引起了这个问题,我删除了它,它就像一个魅力一样,谢谢。
标签: node.js amazon-web-services xcodebuild aws-codepipeline aws-codecommit