npm run build executes a script named build in the selected package. The name is a convention, not a built-in compiler. Check the package and its available scripts before changing package.json.
Reproduce the boundary in a disposable fixture
Find the intended package scripts and workspace rather than inventing a build step.
Use a new empty temporary directory for this fixture. The example creates only local test data. Commands marked with example.invalid do not identify a real service.
mkdir demo
cd demo
node -e 'require("node:fs").writeFileSync("package.json",JSON.stringify({name:"script-fixture",version:"1.0.0",scripts:{check:"node --version"}}))'
npm run
if npm run build >missing.txt 2>&1; then exit 1; fi
npm run check
node -e 'const p=require("./package.json"); console.log(Object.keys(p.scripts))' Observed result
Scripts available in script-fixture@1.0.0 via `npm run`:
check
node --version
> script-fixture@1.0.0 check
> node --version
v26.5.0
[ 'check' ]What the result means
The fixture has a check script but deliberately no build script. npm run lists the available names and npm run build fails before invoking a compiler. Installing dependencies cannot create a missing project script automatically. The important observation is the selected package manifest; the output from a missing script does not tell you which framework, bundler or deployment output the project intended.
Choose the correction for your workflow
In your checkout, inspect package.json and the project instructions. Confirm the current directory and, for a monorepo, identify which workspace owns the application. Use npm run --workspace=PACKAGE to list that package scripts, then run its documented build script. If the project truly needs a new script, choose the command and output from its existing build tooling and test that output. Do not copy a React, Vite or webpack command into an unrelated project merely because the script name matches.
Limits and the next check
--if-present can intentionally skip optional scripts in heterogeneous workspaces; using it to hide a required build failure may produce a successful job with no artifact. npm install and cache clearing are separate operations. The local fixture lists scripts and observes a missing name without installing packages or invoking project lifecycle scripts. Framework-specific compilation errors require their own diagnosis after the correct script actually starts.
Related: Compare the related workflow boundary.
This isolated example was executed on macOS on November 10, 2026 (KST). Available tools: node v26.5.0, git git version 2.39.3 (Apple Git-145), npm 11.17.0, jq jq-1.7.1-apple. Shell fixtures use Bash and repository-path identity uses Python 3. This checks the illustrated contract, not your project, host service or every tool version.