Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Node.js, PHP and APIs

npx stops with 'could not determine executable to run'

Errornpm error could not determine executable to run

Short 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.

  • Applies to npm 10, npm 11, Node.js 22, Tailwind CSS 4
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 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 bin
  2. 2Match what you see, then jump to its fix

    1. 1The 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. 2npm 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. 3You 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

What does the error look like?

  • npm error could not determine executable to run
  • npm 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 bin

2Fix

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 --watch

3Verify

npx now starts the tool and prints build output instead of the error.

npx @tailwindcss/cli --help

Confirmed by tailwindcss.com

Did this fix it?

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> bin

2Fix

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> --help

3Verify

The named command runs, and its own help text appears.

npx --package=<package-name> <command-name> --version

Confirmed by docs.npmjs.com

Did this fix it?

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 node

3Verify

Run the local package from its own folder.

npx my-tool --help

Confirmed by docs.npmjs.com

Did this fix it?

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

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 fix

Back 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 fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.