Skip to content
Community

EXPLORE TOPICS

Editorial approach

New to CoreTrailKit?

Observe your services. Keep the evidence close.

CoreTrailKit
Back to articles
GUIDE/ npm

npm build tool missing after omitting dev deps

The install succeeds, but npm run build cannot find its bundler or compiler. The build command may come from devDependencies that the install stage deliberately omitted.

By CoreTrailKit3 min read

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.

sh · EXAMPLE
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.

sh · EXAMPLE
# In a disposable build checkout:
npm ci --include=dev --ignore-scripts
npm run build

04

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

CONTINUE EXPLORING