Skip to content

/errors/bun/script-not-found

bun run: error: Script not found "dev"

verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash)updated
tool
Bun
exit code
1
versions
Bun 1.x
os
any

error: Script not found "dev" means bun run dev found no dev entry in the scripts of the nearest package.json, and no file named dev to execute. Run bun run with no arguments to list the scripts that exist, then either use the correct name or add a "dev" script to package.json.

Reproduce it

bash
cat > package.json <<'EOF'
{ "name": "app", "scripts": { "build": "echo building" } }
EOF
npx --yes bun@1 run dev

Output · exit 1

error: Script not found "dev"

Fix

Add the script, or call the one that exists:

bash
cat > package.json <<'EOF'
{ "name": "app", "scripts": { "build": "echo building", "dev": "echo dev server" } }
EOF
npx --yes bun@1 run dev

Output

$ echo dev server
dev server

How bun run resolves its argument

ArgumentWhat Bun runs
A name in package.json "scripts"That script, with node_modules/.bin on PATH
A file path (./index.ts, src/app.js)The file, transpiled on the fly
A binary in node_modules/.binThe package binary (like npx)
Anything elseerror: Script not found

bun dev (without run) also runs the script, but a Bun built-in command with the same name (test, build, install) wins: use bun run test to run a test script instead of Bun's test runner. In a workspace, bun run --filter 'pkg-name' dev runs the script in the matching packages.

Sources