Skip to content
Latchkey

yarn run: Execute Scripts

yarn run executes your defined scripts with local bins on PATH.

Like npm run, yarn run is the CI entry point for build/test/lint. Yarn lets you omit run for non-reserved script names.

Common usage

  • yarn run <script> or yarn <script>
  • yarn <script> <args> - forwards args (no -- needed in Berry)
  • yarn run env - inspect environment

Example in CI

Run the build script.

shell
yarn build

In CI

A non-zero script exit fails the job. In Yarn Berry args after the script name are forwarded directly to the tool.

Key takeaways

  • yarn <script> is shorthand for yarn run.
  • Berry forwards args without --.
  • Non-zero exit fails CI.

Related guides

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