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"
The fix that worked
See the scripts npm found, and which package.json it read:
npm run
npm prefixNot it? Every cause, tested ↓Tested on
- OS
- Windows 11 Pro 26200
- Node
- 24.14.0
- npm
- 11.9.0; re-tested on 11.19.1, 12.2.1 and 12.2.2
- Scaffolds checked
- create-vite 9.2.1, Angular 22.2.0, create-next-app 16.3.8; re-checked create-next-app 16.4.3, Angular 22.2.5
✓ Last re-run on GitHub Actions · see the run · all repros
Contents
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. Two details my tests turned up: npm climbs up from a subfolder to the nearest package.json but never down into one, and on npm 12, npm start no longer falls back to node server.js, so a project that started fine on npm 11 now fails with Missing script: "start" (cause 6).
Find your cause in two commands
Run both in the folder where the error appeared:
npm run
npm prefixnpm 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 devIf 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 buildSo 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/webTo run dev in every workspace that has one, add --if-present:
npm run dev --workspaces --if-present5. 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
Since npm 12 there’s a second way to get here. npm used to run node server.js when a project had no start script but did have a server.js. npm 12 dropped that fallback. On November 8, 2026, with the same folder and Node 24.22.2:

If you relied on it, add the script explicitly: "start": "node server.js". That runs the same way on both versions.
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
Runs
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.
November 2, 2026: every cause was re-run on npm 11.19.1 and npm 12.2.1 (Node 24.22.1, GitHub Actions ubuntu-latest), and fresh create-vite, create-next-app 16.4.3 and Angular CLI 22.2.5 projects were generated to check their script names. All results matched, with one difference on npm 12: the npm start → node server.js fallback no longer ran. The script and output are public.
November 8, 2026: the same script on npm 11.19.1 and 12.2.2 (Node 24.22.2): every cause matched again, and the server.js fallback still ran on 11 and not on 12 (run 42509292860).
— N.K., end of entry No.034