p---package Verified current stable Not installed? Package Management

P Package / Execute Binary With Different Name Than Package

Execute Binary With Different Name Than Package

Executes a binary with a different name than its package name.

$
Terminal
bunx -p <package_name> <command>

When To Use

When dealing with packages that expose multiple binaries or when the main executable is aliased under a different name.

Pro Tip

Be cautious of name collisions with globally installed packages, as they can lead to execution of incorrect binaries.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
bunx -p <package_name> <command>

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
Executing binary 'example-command' from package 'example-package'...

Success: Successfully executed 'example-command' from 'example-package'.

Anatomy of Output

Understanding the result

Executing start from example-package binary... Execution Context

Indicates which command is being run.

Status: Running Execution Status

Running process output for the specified command.

Troubleshooting

Common pitfalls

Error: Command not found: start

Solution: Verify that 'start' is a valid command exported by the 'example-package'.

Error: Package 'example-package' does not contain executable for this command.

Solution: Ensure you are pointing to the right package with valid commands.

Error: Ambiguous command, too many matches.

Solution: Specify the command more clearly to avoid ambiguity.

Command Breakdown

What each part is doing

bunx
Base Command
The executable that performs this operation. Here it runs P Package before the shell applies any redirect operators.
-p
p| package
The value supplied for p| package.
<package_name>
package name
The value supplied for package name.
<command>
command
The value supplied for command.
-p
Command Option
Tool-specific option used by this command invocation.

How To Run

Execution path

  1. Step 1

    Run: bunx --package example-package example-command

  2. Step 2

    Check output to ensure the command executed successfully, looking for confirmation messages.

Alternative Approaches

Comparable commands in other tools

Alternative package management tools for the same job.