Wednesday, March 29, 2017

Permission denied issue on yarn global package

Unlike npm, location of global package on yarn is "/usr/bin" as default.
Therefore running yarn command without sudo occur to deny permission.
Avoid this situation, follow next instruction.

Check your default bin location of yarn.
yarn global bin
Create new directory in your favorite location.
mkdir ~/.yarn/global
Change default bin location of yarn.
yarn config set prefix ~/.yarn/global
And add path as environment variable in "~/.bashrc".
export PATH=${PATH}:`yarn global bin`