Overview
Thepm 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
The package or command to execute
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:| Package Manager | Tool Used | Example |
|---|---|---|
| pnpm | pnpx | pnpx create-vite |
| bun | bunx | bunx create-vite |
| npm | npx | npx create-vite |
You don’t need to remember which tool to use -
pm x handles it automatically.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
Fromsrc/commands/x.ts:10-19:
- Detects your package manager
- Maps to the appropriate execution binary (npx/pnpx/bunx)
- Passes all arguments through
- 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: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
Related Commands
- pm run - Run package.json scripts
- pm add - Install packages permanently
- pm install - Install all dependencies