Yarn global command not working Yarn global command not working javascript javascript

Yarn global command not working


You should add export PATH="$PATH:$(yarn global bin)" to your ~/.bash_profile or whatever you use. It would solve the issue.

Depending on how you installed it, Yarn's global folder varies for some reason. You can follow this issue here.


Update Dec 2018

Just updating the path didn't work for me. I had to also set the yarn prefix.

  • Ubuntu 18.04.1 LTS (bionic)
  • yarn 1.12.3
  • npm v3.5.2
  • node v8.10.0
  • zsh 5.4.2

Steps

  1. Confirm your global bin path

    yarn global bin

I got: /home/username/.yarn/bin

  1. set yarn prefix:

    make sure your yarn prefix is the parent directory of your bin directory. You can confirm by running

    yarn config get prefix

    when I ran this, my prefix was empty, so I set it:

    yarn config set prefix ~/.yarn
  2. add the following to ~/.bash_profile or ~/.bashrc

    export PATH="$PATH:`yarn global bin`"

    for zsh users, be sure to add this line to ~/.zshrc

  3. restart your shell or start a new one

    bash -l or zsh


In my case yarn global bin wasn't working.

Try a brew reinstall yarn if that's how you installed yarn

👍🏻