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-appRelated guides
yarn install: Usage, Options & Common CI Errorsyarn install resolves and installs dependencies from yarn.lock. Usage, the --immutable / --frozen-lockfile CI…
npm exec & npx: Usage, Options & Common Errorsnpm exec (and npx) runs a package binary, installing it on demand. Usage, the -- separator, --yes for CI, and…
corepack enable "EACCES permission denied" - Fix Shim Install in CIFix "corepack enable" failing with EACCES in CI/Docker - Corepack cannot write yarn/pnpm shims into a Node bi…