In the JavaScript package manager yarn, the commands yarn dev and yarn run dev are functionally equivalent, both used to execute the dev script defined in the package.json file.
Specifically, yarn run is a command that executes scripts specified in the scripts section of the package.json file. When you directly use yarn [script], yarn automatically interprets it as yarn run [script]. Consequently, for most use cases, these two commands are interchangeable.
For example, if your package.json file includes the following script definition:
json"scripts": { "dev": "node app.js" }
Executing either yarn dev or yarn run dev will run node app.js.
This design streamlines command usage, particularly for frequently invoked script commands during daily development.
It is worth noting that while these commands are functionally equivalent, specific edge cases—such as when using certain plugins or configurations—may require explicitly using yarn run to avoid command conflicts or misinterpretation. However, such scenarios are relatively uncommon.