If you type
yarn --verison (notice spelling mistake, instead of version ), it finds that there are no valid flags and simply starts
If I was just trying to check yarn version, I end up with a yarn.lock file in my directory, if my flag has a typo.
I recommend, if there are any flags, then do not simply assume
yarn install. Yarn just keeps polluting random spaces with yarn.lock files this way.