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
cat > package.json <<'EOF'
{ "name": "app", "scripts": { "build": "echo building" } }
EOF
npx --yes bun@1 run devOutput · exit 1
error: Script not found "dev"
Fix
Add the script, or call the one that exists:
cat > package.json <<'EOF'
{ "name": "app", "scripts": { "build": "echo building", "dev": "echo dev server" } }
EOF
npx --yes bun@1 run devOutput
$ echo dev server dev server
How bun run resolves its argument
| Argument | What 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/.bin | The package binary (like npx) |
| Anything else | error: 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
Related pages
commands · bunbun run index.ts: run a TypeScript file with Bunbun run file.ts (or bun file.ts) executes TypeScript directly: Bun strips types without a build step but does not type-check. Add tsc --noEmit for type errors.commands · bunbun test: run tests with Bun's built-in test runnerbun test finds *.test.ts and *_spec files and runs them with a Jest-compatible API from bun:test. Filter by name, watch mode, coverage and exit codes explained.flags · npmnpm run script -- --flag: pass arguments to an npm scriptArguments after -- in npm run script -- --flag are passed to the script. Without the --, npm takes the flag as its own config and the script never sees it.