DOP-C02 SDLC Automation Practice Question
A DevOps engineer is setting up an AWS CodeBuild project to build a Node.js application. The buildspec.yml file includes a pre_build phase that runs npm install and a build phase that runs npm run build. The build is failing with an error indicating that the 'node' command is not found. The CodeBuild project uses a standard Ubuntu image with the 'aws/codebuild/standard:5.0' image. What is the most likely cause of the failure?
⚠ Common exam trap
The trap here is assuming that the standard image includes Node.js by default, when it actually requires explicit runtime version specification in the buildspec.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The buildspec.yml file is missing a runtime-versions section specifying Node.js.
CodeBuild standard images require the runtime-versions section in the buildspec.yml to install and configure the desired runtime, such as Node.js. Without it, the image may not have Node.js installed, leading to a 'command not found' error. Specifying runtime-versions ensures the correct version is available in the PATH for all phases.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The CodeBuild service role lacks permissions to download Node.js from the internet.
Why it's wrong here
CodeBuild standard images have internet access by default and can download packages. The service role permissions do not affect the ability to download runtimes; they control AWS API access. The error is about a missing command, not a permission denied during download. Thus, this is not the cause.
- ✗
The build phase is using a different shell that does not have Node.js in its PATH.
Why it's wrong here
CodeBuild uses the same shell environment across phases by default. If Node.js were installed in the image, it would be available in all phases. The issue is that Node.js is not installed at all because the runtime version was not specified. The shell is not the problem; the missing runtime is.
- ✓
The buildspec.yml file is missing a runtime-versions section specifying Node.js.
Why this is correct
In CodeBuild standard images, the runtime-versions section in the buildspec.yml is required to install and set up the desired runtime, such as Node.js. Without it, the image may not have Node.js pre-installed or may not be in the PATH. The error indicates that the node command is not found, which is resolved by specifying the runtime version.
- ✗
The pre_build phase must include a command to install Node.js manually using apt-get.
Why it's wrong here
While you could manually install Node.js, CodeBuild standard images support specifying runtime versions in the buildspec.yml, which automatically installs and configures the runtime. Manual installation is unnecessary and less efficient. The recommended approach is to use the runtime-versions section, not to run apt-get commands.
Go deeper
Related to this question
About these practice questions
Courseiva writes every DOP-C02 question from scratch — 1,298 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint
This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.