Skip to main content

Overview

The pm x command executes packages directly from the registry without permanently installing them. It’s the Better PM equivalent of npx, pnpx, or bunx, automatically using the right tool for your package manager.

Syntax

Arguments

string
required
The package or command to execute
string[]
Arguments to pass to the executed command

Examples

Run Package Binary

Output

Execute One-off Command

Output

Run CLI Tool

Output

Execute with Arguments

Output

Run Versioned Package

Output

Package Manager Mapping

Better PM automatically uses the appropriate execution tool:
You don’t need to remember which tool to use - pm x handles it automatically.
From src/commands/x.ts:13-14:

Use Cases

Project Scaffolding

Create new projects without global installs:

One-time Tools

Run tools you don’t need permanently:

Version Testing

Test different package versions:

CI/CD Scripts

Run commands without adding to dependencies:

Common Commands

Create Projects

Development Tools

Generators

How It Works

From src/commands/x.ts:10-19:
The command:
  1. Detects your package manager
  2. Maps to the appropriate execution binary (npx/pnpx/bunx)
  3. Passes all arguments through
  4. Executes the command

Benefits

No Global Installs

Keep your global environment clean:

Always Latest Version

Run the latest version without updating:

Try Before Installing

Test tools before adding to package.json:

Package Manager Agnostic

Same command works everywhere:

Performance

Execution tools cache packages for faster subsequent runs:
For frequently used tools, consider installing them locally with pm add -D for even better performance.

Best Practices

Use for Generators

Use for One-off Tasks

Install for Repeated Use

Pin Versions for Consistency

Common Workflows

Quick Project Setup

Format and Lint

Generate Files

Run Scripts

  • pm run - Run package.json scripts
  • pm add - Install packages permanently
  • pm install - Install all dependencies