I created a code pipeline with very simple code and connected to codecommit. tried to build it but it is failing at codebuild step stating error executing npm install. Am I missing something? Sorry I was new to this codebuild/ codepipeline.
Below is the log for codebuild failure:
[Container] 2019/02/15 11:47:39 Waiting for agent ping
[Container] 2019/02/15 11:47:40 Waiting for DOWNLOAD_SOURCE
[Container] 2019/02/15 11:47:40 Phase is DOWNLOAD_SOURCE
[Container] 2019/02/15 11:47:40 CODEBUILD_SRC_DIR=/codebuild/output/src501317273/src
[Container] 2019/02/15 11:47:40 YAML location is /codebuild/output/src501317273/src/buildspec.yml
[Container] 2019/02/15 11:47:40 Processing environment variables
[Container] 2019/02/15 11:47:40 Moving to directory /codebuild/output/src501317273/src
[Container] 2019/02/15 11:47:40 Registering with agent
[Container] 2019/02/15 11:47:40 Phases found in YAML: 1
[Container] 2019/02/15 11:47:40 BUILD: 2 commands
[Container] 2019/02/15 11:47:40 Phase complete: DOWNLOAD_SOURCE Success: true
[Container] 2019/02/15 11:47:40 Phase context status code: Message:
[Container] 2019/02/15 11:47:40 Entering phase INSTALL
[Container] 2019/02/15 11:47:40 Phase complete: INSTALL Success: true
[Container] 2019/02/15 11:47:40 Phase context status code: Message:
[Container] 2019/02/15 11:47:40 Entering phase PRE_BUILD
[Container] 2019/02/15 11:47:40 Phase complete: PRE_BUILD Success: true
[Container] 2019/02/15 11:47:40 Phase context status code: Message:
[Container] 2019/02/15 11:47:41 Entering phase BUILD
[Container] 2019/02/15 11:47:41 Running command npm install
sh: 1: npm: not found
[Container] 2019/02/15 11:47:41 Command did not exit successfully npm install exit status 127
[Container] 2019/02/15 11:47:41 Phase complete: BUILD Success: false
[Container] 2019/02/15 11:47:41 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm install. Reason: exit status 127
[Container] 2019/02/15 11:47:41 Entering phase POST_BUILD
[Container] 2019/02/15 11:47:41 Phase complete: POST_BUILD Success: true
[Container] 2019/02/15 11:47:41 Phase context status code: Message:
[Container] 2019/02/15 11:47:41 Expanding base directory path: .
[Container] 2019/02/15 11:47:41 Assembling file list
[Container] 2019/02/15 11:47:41 Expanding .
[Container] 2019/02/15 11:47:41 Expanding artifact file paths for base directory .
[Container] 2019/02/15 11:47:41 Assembling file list
[Container] 2019/02/15 11:47:41 Expanding post-saml.yaml
[Container] 2019/02/15 11:47:41 Skipping invalid artifact path post-saml.yaml
[Container] 2019/02/15 11:47:41 Expanding beta.json
[Container] 2019/02/15 11:47:41 Found 1 file(s)
[Container] 2019/02/15 11:47:41 Phase complete: UPLOAD_ARTIFACTS Success: true
[Container] 2019/02/15 11:47:41 Phase context status code: Message:
My buildspec.yml file looks like this:
version: 0.0
environment_variables:
plaintext:
"INPUT_FILE": "serverless.yml"
"S3_BUCKET": ""
containers:
LambdaFunctions:
phases:
during_build:
commands:
- npm install
- aws cloudformation package --template $INPUT_FILE --s3-bucket $S3_BUCKET --output-template post-saml.yaml
artifacts:
files:
- post-saml.yaml
- beta.json