Skip to content
Latchkey

npm "Missing script" - Fix npm run for a Script That Does Not Exist

npm run executes a named entry from the scripts block. "Missing script" means that name is not defined where npm looked - a typo, the wrong package.json, or the wrong workspace.

What this error means

npm run <name> fails with npm error Missing script: "<name>" and lists available scripts. Nothing runs because the script is not in the package.json npm resolved.

npm output
npm error Missing script: "buld"
npm error
npm error To see a list of scripts, run:
npm error   npm run

Common causes

Typo or undefined script name

The script name passed to npm run does not match any key in scripts (e.g. buld vs build).

Wrong working directory or workspace

In a monorepo, running from the root (or the wrong package) means the script lives in a different package.json than the one npm read.

How to fix it

List scripts and run the right name

See what scripts exist where you are, and target the correct package.

Terminal
npm run                 # lists available scripts
# in a workspace, target the package:
npm run build -w @acme/web

Check directory and workspace

  1. Confirm you are in the directory whose package.json defines the script.
  2. For monorepos, use -w <name> to target the right workspace.
  3. Fix the script name typo in the CI invocation.

How to prevent it

  • Define every script your CI invokes in the right package.json.
  • Use -w to target workspace scripts explicitly.
  • Run npm run to confirm available scripts.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →