Skip to content
Latchkey

yarn dlx: Usage & Common Errors

Run a package binary without installing it (Yarn Berry).

yarn dlx fetches a package into a temporary environment and runs its binary, then discards it - the Yarn 2+/Berry equivalent of npx for one-off tools.

What it does

Installs the package in a throwaway folder, runs the requested binary, and cleans up - nothing is added to your project. It exists only in Yarn 2+ (Berry); Yarn 1 has no dlx, so use npx there. Use -p to disambiguate the package from the binary name.

Common usage

Terminal
yarn dlx create-react-app my-app
yarn dlx -p typescript tsc --version    # binary differs from package
yarn dlx eslint .

Common CI error: dlx not found on Yarn 1

A pipeline pinned to Yarn 1 fails with "Command \"dlx\" not found" because dlx is a Berry-only command. Either enable Berry (yarn set version stable / corepack) or use npx for the one-off tool on Yarn 1.

Terminal
# Yarn 1 fallback:
npx create-react-app my-app

Related guides

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