First of all, you need to check permission by running the command:
ls -la ~/.config/yarn/global/node_modules/.yarn*
I received the next response:
-rw-r--r-- 1 root staff 15163 Jul 18 15:17 ~/.config/yarn/global/node_modules/.yarn-integrity
Then if you saw that root had permission, but you don’t have, you should add permission to yourself:
sudo chown -R ${USER} ~/.config/yarn/