Skip to content
Latchkey

yarn dlx: Run a Package Once

yarn dlx fetches and runs a package without adding it to the project.

dlx is the Berry replacement for npx, isolating the tool so it never pollutes your dependencies.

Common usage

  • yarn dlx <pkg> [args]
  • yarn dlx -p <pkg> <cmd> - different bin name
  • pin: yarn dlx <pkg>@<version>

Example in CI

Run a scaffolding tool once.

shell
yarn dlx create-vite@latest my-app

In CI

Pin the version for reproducibility. For repeated use, add it as a devDependency instead of fetching every run.

Key takeaways

  • yarn dlx is Berry’s npx.
  • Pin versions in CI.
  • Add frequent tools as devDependencies.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →