npx stops with 'could not determine executable to run'
npm error could not determine executable to runShort answer
npx picks the command from the package's bin field. If the package has no bin entry, or has several and none matches its name, npx exits with this error. Look at the bin field of the package, then name the command yourself with --package, or run the package that really ships the CLI.
Fix it fast
1Find out which cause you have
Print the bin field of the package you are trying to run. The result shows whether it has no command, one command or several.
npm view tailwindcss bin2Match what you see, then jump to its fix
- 1
The package has an empty bin field, or you typed the name of a library and not of its CLI packageThe package ships no command with that nameFix - 2
npm view shows a bin object with two or more keys, and none equals the package nameThe package has several commands and none matches its nameFix - 3
You run npx against your own package folder or a git URL and the package.json has no bin keyThe bin field in your own package is missing or wrongFix
- 1
What does the error look like?
npm error could not determine executable to runnpm ERR! could not determine executable to run
Cause 1 of 3
The package ships no command with that name
1Check
npx infers the command from the package name only when the package has exactly one bin entry, or one entry that matches the unscoped package name. A library with no bin entry can never be run this way. Tailwind CSS 4 is an example: its command line tool moved to a separate package.
npm view tailwindcss bin
npm view @tailwindcss/cli bin2Fix
Run the package that really contains the CLI. Install it, then call it by its documented name.
npm install tailwindcss @tailwindcss/cli
npx @tailwindcss/cli -i ./src/input.css -o ./src/output.css --watch3Verify
npx now starts the tool and prints build output instead of the error.
npx @tailwindcss/cli --helpConfirmed by tailwindcss.com
Cause 2 of 3
The package has several commands and none matches its name
1Check
With several bin entries, npx needs one that equals the unscoped part of the package name. Otherwise it gives up. The keys of the bin object are the command names you can ask for.
npm view <package-name> bin2Fix
Tell npx which package to load with --package, and put the command name after it. Flags for npx go before the command.
npx --package=<package-name> <command-name> --help3Verify
The named command runs, and its own help text appears.
npx --package=<package-name> <command-name> --versionConfirmed by docs.npmjs.com
Cause 3 of 3
The bin field in your own package is missing or wrong
1Check
The bin field maps a command name to a file. Without it npm links nothing. A string value is only valid when the command should carry the package name.
node -p "JSON.stringify(require('./package.json').bin)"2Fix
Add a bin map that points at your script. The script should begin with the node shebang line.
{
"name": "my-tool",
"bin": { "my-tool": "bin/cli.js" }
}
# first line of bin/cli.js
#!/usr/bin/env node3Verify
Run the local package from its own folder.
npx my-tool --helpConfirmed by docs.npmjs.com
How do I stop it coming back?
- Read the install page of a tool before you copy an npx line; the CLI package name can differ from the library name.
- When you publish a CLI, set bin in package.json and keep one command named like the package.
- Write npx commands in docs and scripts with --package when the command name differs from the package.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
Related fixes
Back end
Vite reports that tailwindcss cannot be used directly as a PostCSS plugin
Internal server error: [postcss] It looks like you're trying to use `tailwindcss` directly as a PostCSS plugin.
In Tailwind CSS v4 the PostCSS plugin moved out of the tailwindcss package.
3 causes, each with a fixBack end
ng serve says it cannot determine the project or target
Cannot determine project for command.
The Angular CLI looked through angular.json for a project that defines the target you asked for (serve, build, test) and found none, or found several and could not pick one.
3 causes, each with a fixBack end
ng fails with Cannot find module @angular/cli/bin/ng
Cannot find module '@angular/cli/bin/ng'
The ng command is the entry point to the Angular CLI package.
2 causes, each with a fixBack end
Angular app shows 'Cannot GET /' when served by a Node.js server
Cannot GET /dashboard
Cannot GET / is Express saying no route or file matches the request.
3 causes, each with a fixBack end
ng serve cannot find the dev-server builder package
Could not find the implementation for builder @angular/build:dev-server
The builder named in angular.json (for example @angular-devkit/build-angular:dev-server) is looked up as an npm package starting from the workspace root.
3 causes, each with a fixBack end
Angular build says it cannot resolve '@angular/localize/init'
Can't resolve '@angular/localize/init' in '/usr/src/app/src'
The build imports @angular/localize, and that package is not in node_modules.
2 causes, each with a fix