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-appIn CI
Pin the version for reproducibility. For repeated use, add it as a devDependency instead of fetching every run.
Key takeaways
yarn dlxis Berry’s npx.- Pin versions in CI.
- Add frequent tools as devDependencies.