Aws lambda AWS Codebuild buildspec.yaml找不到文件
]我为lambda函数服务设置了一个aws管道,该服务是用typescript编写的。我正在使用sam进行无服务器部署。在我的buildspec.yaml中,我有一个命令,该命令假定运行我的package.json中的一个预构建脚本来编译typescript,但代码构建说没有这样的文件或目录Aws lambda AWS Codebuild buildspec.yaml找不到文件,aws-lambda,yaml,amazon-cloudformation,aws-codepipeline,aws-sam,Aws Lambda,Yaml,Amazon Cloudformation,Aws Codepipeline,Aws Sam,]我为lambda函数服务设置了一个aws管道,该服务是用typescript编写的。我正在使用sam进行无服务器部署。在我的buildspec.yaml中,我有一个命令,该命令假定运行我的package.json中的一个预构建脚本来编译typescript,但代码构建说没有这样的文件或目录 phases: build: commands: - npm run compile artifacts: files: - package.json - pa
phases:
build:
commands:
- npm run compile
artifacts:
files:
- package.json
- package-lock.json
[]确保.yml文件不在子文件夹中且不在顶层。@PHPNoob我做了更改,但仍然出现相同的错误。您能显示或描述您的文件结构吗?@PHPNoob我已添加了我的文件结构的图片如果您在文件夹中有buildspec,请将其从文件夹中删除,例如,它应该位于主目录中,如
自述文件.md
和模板.yaml
文件。请确保.yml文件不在子文件夹中,也不在顶层。@PHPNoob我做了更改,但仍然出现相同的错误。您能显示或描述您的文件结构吗?@PHPNoob我已经添加了一张我的文件结构图片,您呢将buildspec放在文件夹中,将其从文件夹中删除,例如,它应该位于主目录中,如README.md
和template.yaml
文件。
[Container] 2020/09/21 15:12:00 Waiting for agent ping
[Container] 2020/09/21 15:12:04 Waiting for DOWNLOAD_SOURCE
[Container] 2020/09/21 15:12:18 Phase is DOWNLOAD_SOURCE
[Container] 2020/09/21 15:12:18 CODEBUILD_SRC_DIR=/codebuild/output/src071783151/src
[Container] 2020/09/21 15:12:18 YAML location is /codebuild/output/src071783151/src/config/buildspec.dev.yml
[Container] 2020/09/21 15:12:18 Processing environment variables
[Container] 2020/09/21 15:12:18 No runtime version selected in buildspec.
[Container] 2020/09/21 15:12:18 Moving to directory /codebuild/output/src071783151/src
[Container] 2020/09/21 15:12:18 Registering with agent
[Container] 2020/09/21 15:12:18 Phases found in YAML: 1
[Container] 2020/09/21 15:12:18 BUILD: 1 commands
[Container] 2020/09/21 15:12:18 Phase complete: DOWNLOAD_SOURCE State: SUCCEEDED
[Container] 2020/09/21 15:12:18 Phase context status code: Message:
[Container] 2020/09/21 15:12:18 Entering phase INSTALL
[Container] 2020/09/21 15:12:18 Phase complete: INSTALL State: SUCCEEDED
[Container] 2020/09/21 15:12:18 Phase context status code: Message:
[Container] 2020/09/21 15:12:18 Entering phase PRE_BUILD
[Container] 2020/09/21 15:12:18 Phase complete: PRE_BUILD State: SUCCEEDED
[Container] 2020/09/21 15:12:18 Phase context status code: Message:
[Container] 2020/09/21 15:12:18 Entering phase BUILD
[Container] 2020/09/21 15:12:18 Running command npm run compile
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /codebuild/output/src071783151/src/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/codebuild/output/src071783151/src/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-09-21T15_12_25_587Z-debug.log
[Container] 2020/09/21 15:12:25 Command did not exit successfully npm run compile exit status 254
[Container] 2020/09/21 15:12:25 Phase complete: BUILD State: FAILED
[Container] 2020/09/21 15:12:25 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm run compile. Reason: exit status 254
[Container] 2020/09/21 15:12:25 Entering phase POST_BUILD
[Container] 2020/09/21 15:12:25 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2020/09/21 15:12:25 Phase context status code: Message:
[Container] 2020/09/21 15:12:25 Expanding base directory path: .
[Container] 2020/09/21 15:12:25 Assembling file list
[Container] 2020/09/21 15:12:25 Expanding .
[Container] 2020/09/21 15:12:25 Expanding file paths for base directory .
[Container] 2020/09/21 15:12:25 Assembling file list
[Container] 2020/09/21 15:12:25 Expanding package.json
[Container] 2020/09/21 15:12:25 Skipping invalid file path package.json
[Container] 2020/09/21 15:12:25 Expanding package-lock.json
[Container] 2020/09/21 15:12:25 Skipping invalid file path package-lock.json