Skip to content

/errors/npm/missing-script

npm error Missing script: "start"

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · 11.19.0updated
tool
npm
exit code
1
versions
npm 7 – 11
os
any

npm error Missing script: "start" means npm start or npm run start looked under "scripts" in the current package.json and found no start entry. npm only runs scripts defined there. Run npm run to list the scripts that exist, then either use the right name (often dev or serve) or add "start": "node server.js" to package.json.

Reproduce it

bash
cat > package.json <<'EOF'
{ "name": "app", "version": "1.0.0", "scripts": { "build": "echo building" } }
EOF
npm run start 2>&1 | grep -v "complete log"
exit "${PIPESTATUS[0]}"

Output · exit 1

npm error Missing script: "start"
npm error
npm error Did you mean one of these?
npm error   npm star # Mark your favorite packages
npm error   npm stars # View packages marked as favorites
npm error
npm error To see a list of scripts, run:
npm error   npm run

The Did you mean one of these? block lists npm commands or scripts with a similar name. Here it suggests npm star because no script is close to start.

Fix

List what exists, then add the missing script:

bash
cat > package.json <<'EOF'
{ "name": "app", "version": "1.0.0", "scripts": { "build": "echo building" } }
EOF
npm run
npm pkg set scripts.start="node -e \"console.log('started')\""
npm run start --silent

Output

Scripts available in app@1.0.0 via `npm run`:
  build
    echo building
started

npm pkg set edits package.json without opening an editor. --silent hides the > app@1.0.0 start header line.

CommandLooks for
npm startscripts.start, or node server.js if server.js exists
npm testscripts.test
npm run devscripts.dev (no fallback)
npm runLists all scripts of the current package.json

In npm 6 and earlier the same error read npm ERR! missing script: start.

Sources