yarn run: Usage, Options & Common Errors
Run scripts and local binaries.
yarn run executes a script from package.json with node_modules/.bin on PATH. yarn <script> works too - the run keyword is optional for non-builtin names.
What it does
Looks up the script in package.json and runs it, or runs a binary from node_modules/.bin directly. yarn run with no name lists scripts. Arguments after the script name are forwarded (Berry forwards directly; Yarn 1 also accepts them).
Common usage
yarn run build # run the build script
yarn build # "run" is optional
yarn test --watch # forward --watch to the test command
yarn run # list scripts (Yarn 1)Common CI error: command not found
yarn run fails with "command not found: <script>" because the script name does not exist or the binary was never installed (devDependency skipped with --production). List scripts to confirm the name, and make sure the install step included the dependency that provides the binary.
yarn run # Yarn 1: list available scripts