yarn run — Yarn CLI reference
Run a dependency binary or local script
yarn run
Run a dependency binary or local script
This command runs a tool selected from the current workspace:
-
If the local package.json
scriptsfield contains a matching script name, Yarn executes that script. -
Otherwise, if a
taskfileexists in the workspace and contains a task with the matching name, Yarn runs that task (including all its dependencies in the correct order). -
Otherwise, if one of the local workspace’s dependencies exposes a binary with a matching name, Yarn runs that binary.
-
Otherwise, if the specified name contains a colon character and if one of the workspaces in the project contains exactly one script with a matching name, Yarn runs that script.
Script commands run from the workspace that declares them. Dependency binaries run from the current working directory unless --run-cwd is set.
Resolve scripts and binaries from the top-level workspace
Only consider dependency binaries, not package scripts or tasks
Return an error when the script, task, or binary cannot be found
Directory from which to run the selected script or binary
Forward --inspect to Node.js when executing a Node binary
Forward --inspect-brk to Node.js when executing a Node binary
Forward --inspect-wait to Node.js when executing a Node binary
Preload a module through Node.js --require when executing a Node binary