Skip to content
Latchkey

pnpm dlx: Usage & Common Errors

Run a package binary without installing it.

pnpm dlx downloads a package to a temporary location and runs its binary, then discards it - the pnpm equivalent of npx. pnpm exec, by contrast, runs an already-installed binary.

What it does

Fetches the package into a throwaway store entry, runs the requested command, and leaves your project untouched. Use --package to name the package when its binary differs from its name. For binaries already in node_modules, prefer pnpm exec (no download).

Common usage

Terminal
pnpm dlx create-vite my-app
pnpm dlx --package=typescript tsc --version
pnpm exec eslint .          # run an already-installed binary

Common CI gotcha: dlx re-downloads every run

Using pnpm dlx for a tool you run every build re-fetches it each time, slowing CI. If the tool is a project dependency, add it and use pnpm exec instead so it comes from the cached store rather than a fresh download.

Terminal
pnpm add -D eslint && pnpm exec eslint .

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →