Blog
7 min read

npm "Missing script: dev" (or "start"): What It Means and How to Fix It

npm error Missing script dev means the package.json npm found has no dev script. Check the folder, list scripts with npm run, and use the right name.

npm's "Missing script" error means the package.json npm is reading has no entry with that name in its "scripts" section. Your installed packages are fine. Usually you're in the wrong folder, or the project calls the command something else. Run npm run with no arguments to list the scripts that do exist, then use one of those names.

Checked against the npm docs for npm run, npm start and folders, and by running npm 9, 10 and 11, in November 2026.

What the error looks like

With a current npm (10.6 or later, including npm 11):

npm error Missing script: "dev"
npm error
npm error To see a list of scripts, run:
npm error   npm run
npm error A complete log of this run can be found in: /home/you/.npm/_logs/2026-11-18T09_12_44_120Z-debug-0.log

Older versions print the same text with npm ERR! at the start of each line instead of npm error. The start version sometimes adds a "Did you mean one of these?" block suggesting npm star and npm stars. Those are unrelated npm commands for bookmarking packages, so ignore them.

If a similar script exists with different capitalisation, npm points you to it:

npm error Missing script: "dev"
npm error
npm error Did you mean this?
npm error   npm run Dev # run the "Dev" package script

Script names are case-sensitive, so Dev and dev are different scripts.

What npm is actually doing

npm run dev doesn't know anything about Vite, Next.js or your framework. It opens package.json, looks inside "scripts" for a key called dev, and runs the command stored there:

{
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  }
}

No dev key, no command to run, so you get "Missing script". (What Are npm and package.json? explains the file if it's new to you.)

Step 1: list the scripts npm can see

npm run

The npm docs say that with no command, it "will list the available scripts." The output looks like this:

Lifecycle scripts included in my-app@1.0.0:
  test
    vitest
available via `npm run-script`:
  dev
    vite
  build
    vite build

Three outcomes:

  • You see the script you want under a different name (serve, develop, start:dev). Run that one.
  • You see scripts, but they belong to a different project. The header names the package npm is reading (my-app@1.0.0 above). If that's not your project, you're reading the wrong package.json.
  • You see nothing at all. This package.json has no scripts. Often it's a monorepo root (see below).

Cause 1: you're in the wrong folder

This is the most common one, especially in projects generated by AI tools or templates that put the app in a subfolder like frontend/, client/, web/ or the project's name.

pwd
ls

If you don't see package.json here, cd into the folder that has it. One detail makes this confusing: npm doesn't only look in the current folder. According to the npm docs, it walks up the folder tree until it finds a folder containing a package.json or a node_modules folder, and treats that as the project. So:

  • Running from a subfolder like src/ works, because npm finds the project root above it.
  • If there's a stray package.json higher up, for example in your home folder after an accidental npm install there, npm uses that one. Its scripts won't include dev, so you get "Missing script" for a file you didn't know existed.
  • If npm finds no package.json anywhere up the tree, you get a different error, npm error code ENOENT with "Could not read package.json". That one is covered in npm ERR! code ENOENT.

Cause 2: the project uses a different script name

Different tools generate different script names, and tutorials don't always match the template you used:

Created with Scripts it generates Start the dev server with
Vite (npm create vite) dev, build, preview (plus lint in some templates) npm run dev
Next.js (create-next-app) dev, build, start (plus lint if you chose a linter) npm run dev
Create React App start, build, test, eject npm start

So a tutorial written for Create React App says npm start, but a Vite project has no start script and you get Missing script: "start". The reverse happens too. Create React App was deprecated for new apps in February 2025, so most new React projects use Vite or a framework, and npm run dev is the more likely command today.

Next.js has both, and they do different things: dev runs the development server, start serves a production build you made with npm run build. npm run dev vs npm run build vs npm start explains the difference.

Cause 3: npm start and the server.js default

npm start has one special rule. The npm docs say: "If the "scripts" object does not define a "start" property, npm will run node server.js."

That means:

  • A project with a server.js file and no start script still starts fine with npm start.
  • A project with no start script and no server.js gives Missing script: "start".

If your entry file is named something else (index.js, app.js, dist/main.js), add a start script that points at it:

npm pkg set scripts.start="node index.js"

npm pkg set edits package.json for you, which avoids JSON typos. You can also edit the file by hand.

This one often shows up in deployment. A Dockerfile ending in CMD ["npm", "start"], or a hosting platform set to run npm start, fails the same way if the project only defines dev.

Cause 4: a monorepo or workspace

In a monorepo, the root package.json often holds no scripts, or only a few, while each app has its own package.json with dev inside. Running npm run dev at the root gives "Missing script" even though the script exists one level down.

If the repo uses npm workspaces (a "workspaces" field in the root package.json), you can run a workspace's script from the root:

npm run dev --workspace=apps/web
# short form:
npm run dev -w apps/web

To see every workspace's scripts at once:

npm run --workspaces

And to run dev in every workspace that defines it, skipping the ones that don't:

npm run dev --workspaces --if-present

Without workspaces configured, just cd apps/web and run it there. (pnpm Workspaces covers the same idea for pnpm.)

Cause 5: the script is there, but not where npm looks

Less common, but worth a quick look in package.json:

  • Typo in the key, such as "scirpts" or "script". npm only reads "scripts".
  • Script nested in the wrong place, for example inside "dependencies" or another object.
  • Two "scripts" blocks. npm reads the file without complaint, but only the last block counts. If dev is in the first block, npm won't see it.
  • Different capitalisation, as shown above.

Quick checklist

  1. Run npm run to list the scripts npm can see.
  2. Check pwd and ls; cd into the folder that contains the app's package.json.
  3. Use the script name the project defines (dev for Vite, start for Create React App).
  4. For npm start, add a start script or make sure server.js exists.
  5. In a monorepo, use -w <workspace> or cd into the app.
  6. Check package.json for a misspelled or duplicated "scripts" key.

If Claude Code is running your project on EasySpawn, it works in the real project folder on a persistent server, so it can run npm run to see the scripts and start the right one. The app then runs at a live URL instead of on your laptop. See how it works or join the waitlist.

Related: What Are npm and package.json? A Beginner's Guide · npm run dev vs npm run build vs npm start: What Each One Does · npm ERR! code ENOENT: What It Means and How to Fix It · What Is Vite? The Build Tool Behind Lovable and Bolt Apps, Explained

Keep reading