01
Identify the missing command’s package
Read the shell error inside the npm script and inspect which dependency provides that executable. A missing local tool differs from the script name itself being absent from package.json.
Our app’s build script invoked fixture-bundler. The package was declared only in devDependencies, and an install with --omit=dev left that tool off disk. The build then failed with a command-not-found error.
02
Compare install policy with the build stage
Inspect the exact CI command, the effective omit/include settings, and relevant stage environment. An installation suitable for a production runtime can be insufficient for generating the application artifact.
Read selected settings rather than printing full configuration. npm scripts add local package executables to their command environment, but that does not create a binary belonging to a dependency that was not installed.
npm config get omit
npm config get include
# Inspect scripts.build and the dependency that provides its command.03
Install the intended build tools
For a reviewed project whose build requires development dependencies, include them in its build-stage clean install. The following command preserves the lockfile and explicitly requests dev dependencies.
The lab disabled install lifecycle scripts because all fixtures were local and needed none. Your real project may require approved install hooks; assess that requirement through its normal policy rather than assuming ignore-scripts produces a fully working native dependency tree.
# In a disposable build checkout:
npm ci --include=dev --ignore-scripts
npm run build04
Verify the resulting artifact
The corrected local install made fixture-bundler available, and the explicit build script wrote the expected result file. The test checked both its contents and that package-lock.json remained byte-for-byte unchanged.
For the application, inspect the actual output required by the next stage. A successful command exit without the expected bundle or generated files does not establish that the build contract is satisfied.
05
Keep runtime packaging separate
If the deployment needs only production dependencies and compiled output, implement that stage through the existing packaging design. Including build tools during compilation does not require shipping every development dependency in the runtime image.
Avoid moving a dependency into the production section solely to hide a misplaced build stage. Choose dependency classification from the application’s real needs, then validate a clean build and the final runtime artifact independently.
Know the limits
Reproduced with npm 12.2.1 and Node.js 24.22.1 in a disposable Linux container using local fixtures, with external networking disabled during tests. A local fixture bundler listed only in devDependencies was absent after ci --omit=dev. Including development dependencies restored the command and produced the expected artifact without changing the lockfile. Real bundlers, native hooks, and multi-stage images were not tested.
Sources & further reading
A technical publication by CoreTrailKit.
Browse all articles