Skip to content
Nilay Kabariya

Entry No.036·Fixes·Updated ·5 min read

Fix: npm error Missing script: "dev" (and "start")

npm can't find the script you asked for. Six real causes, from a stray package.json up the tree to monorepos, and two commands that show which one you have.

by Nilay#npm#node#windowsFIXED

The error, verbatim

Jump to the fix ↓
npm error Missing script: "dev"
npm error
npm error To see a list of scripts, run:
npm error   npm run

# the same error for npm start:
npm error Missing script: "start"
✓ Reproduced on Windows 11 Pro

Tested on

OS
Windows 11 Pro 26200
Node
24.14.0
npm
11.9.0
Scaffolds checked
create-vite 9.2.1, Angular 22.2.0, create-next-app 16.3.8
Contents
  1. Find your cause in two commands01
  2. 1. npm is reading a different package.json02
  3. 2. The project calls it something else03
  4. 3. A typo in the name04
  5. 4. A monorepo: the script lives in a workspace05
  6. 5. The script is in the file, but npm can’t see it06
  7. 6. Missing script: “start” after deploying07
  8. What didn’t work08
  9. How this was tested09

The word in quotes changes (dev, start, build, serve, tauri), the meaning doesn’t. npm opened a package.json, looked in its "scripts" block, and the name you typed isn’t there. Usually it’s the right command run against the wrong package.json, and npm doesn’t tell you which one it read.

Find your cause in two commands

Run both in the folder where the error appeared:

npm run
npm prefix

npm run with no name lists every script npm can see. npm prefix prints the folder whose package.json npm is actually using.

What you see Cause Go to
npm prefix is not your project folder npm found a different package.json higher up 1
The list has start, not dev (or the reverse) This project names it differently 2
Your project’s scripts, but the name is close A typo 3
Root of a monorepo, list is empty or short The script lives in a workspace 4
dev is in the file, but not in the list The package.json itself is broken 5

1. npm is reading a different package.json

This is the confusing one. You run npm create vite@latest my-app, forget to cd my-app, and run npm run dev. npm doesn’t stop at the current folder: it walks up until it finds a package.json, and uses that one.

I put a stray package.json two folders up, the way one ends up in C:\Users\<you> after an npm install run in the wrong place, and ran npm run dev one level above the real project:

C:\stray\projects> npm run dev
npm error Missing script: "dev"

C:\stray\projects> npm prefix
C:\stray

npm prefix gives it away: npm was reading C:\stray\package.json, a file with no scripts at all. Move into the project:

cd my-app
npm run dev

If npm prefix points at your user folder, look for a package.json (and node_modules) there that you never meant to create. Delete them only after checking nothing of yours lives there.

With no package.json anywhere above you, you get a different error instead: npm error enoent Could not read package.json. Same mistake (wrong folder), different message.

2. The project calls it something else

Scaffolds don’t agree on the name. I checked what each one writes today:

Created with Dev server script So run
create-vite 9.2.1 (React, Vue, Svelte…) "dev": "vite" npm run dev
create-next-app 16.3.8 "dev": "next dev" npm run dev
Angular CLI 22.2.0 "start": "ng serve" npm start

Use the name from the npm run list, not the one from the tutorial. In my test project with only start and build, the list read:

Lifecycle scripts included in app@1.0.0:
  start
    node src/index.js
available via `npm run`:
  build
    echo build

So npm start worked and npm run dev never will until you add a dev line yourself.

Two things in that output trip people up. start, test, stop and restart are “lifecycle” scripts with shortcuts, so npm start works without run. Everything else needs run: plain npm dev isn’t an npm command at all, and fails with a different message:

Unknown command: "dev"

To see a list of supported npm commands, run:
  npm help

3. A typo in the name

npm error Missing script: "strat"

npm doesn’t suggest the closest script name, only similar npm commands. Compare against the npm run list character by character, including case: Dev and dev are different scripts.

4. A monorepo: the script lives in a workspace

In a repo with "workspaces", the root package.json often has no dev at all. The app’s own package.json does.

C:\mono> npm run dev
npm error Missing script: "dev"

Point npm at the workspace, by package name or by folder:

npm run dev -w web
npm run dev -w apps/web

To run dev in every workspace that has one, add --if-present:

npm run dev --workspaces --if-present

5. The script is in the file, but npm can’t see it

Open package.json and dev is right there, yet npm run doesn’t list it. I reproduced two ways this happens, both silent:

Two "scripts" blocks. Pasting a tutorial’s scripts into a file that already has some leaves two keys with the same name. JSON allows it, and the last one wins:

{
  "scripts": { "dev": "echo DEV" },
  "dependencies": {},
  "scripts": { "build": "echo BUILD" }
}
npm error Missing script: "dev"

Scripts available in dup@1.0.0 via `npm run`:
  build

"script" instead of "scripts". The singular key is ignored without a warning, and dev inside it is invisible.

Merge everything into one "scripts" object, spelled with the s, then check npm run lists it.

6. Missing script: “start” after deploying

Hosts that run npm start by default fail with this when the project only has dev and build. Add a real start command for production (for Vite, "start": "vite preview" serves the built files; for Next.js, "start": "next start"), or set the host’s start command to the script you do have. Don’t point it at dev in production: that’s the development server.

What didn’t work

How this was tested

npm 11.9.0 on Node 24.14.0, Windows 11. Each cause was built on purpose in a fresh folder: a project with only start and build, a stray package.json two levels up, a folder with none above it, a three-package workspace repo, a file with two "scripts" keys, and one with "script". Every message above is the real terminal output. Scaffold script names were read from the published create-vite, Angular and create-next-app templates.

— N.K., end of entry No.036

Useful? Pass it on:Post on XFollow @EmotionalMatter

Related entries

  1. No.042

    Fix: "Could not locate the bindings file" in sqlite3

    sqlite3 or better-sqlite3 installed fine, then can't find its .node file. Four causes reproduced, how the Tried: paths tell them apart, and the fix for each.

    > Error: Could not locate the bindings file. Tried:

    FIXED3 min
  2. No.017

    Fix: 'vite' is not recognized as an internal or external command

    Windows says the command doesn't exist, but it's right there in node_modules. The four causes, how to tell them apart in one command, and what each one needs.

    > 'vite' is not recognized as an internal or external command,

    FIXED4 min
  3. No.039

    npm 12 breaking changes, tested: what actually breaks

    The headline change, install scripts blocked by default, broke puppeteer, cypress, sqlite3 and Claude Code's npm package, and silently skipped lefthook's git hooks. esbuild, bcrypt, sharp and better-sqlite3 kept working. Every install reported success, and the only sign was a warning after the summary.

    TESTED5 min

Post card · Newsletter

Get the next fix in your inbox.

One short email when a new entry is published. No spam, never shared, and you can leave any time.

— Nilay

or follow by RSSor on X

By subscribing you agree to the privacy note. One click to leave.

tip: paste the exact error text