mklabs / yarn-completions

Completion handler for Yarn

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't work in Bash in Mac Terminal

zhenyulin opened this issue · comments

Do I need to enable ZSH to use this?

The install instructions are incomplete. Not sure if this is the correct way to go about it (I've done this on two Ubuntu machines) but here is my recipe:

  1. Make sure that yarn has a global prefix by running yarn config get prefix - I use the ~/.config/yarn/global/bin for the global path*: yarn config set prefix ~/.config/yarn/global/bin
  2. Add the bin path to your PATH variable export PATH="`yarn global bin`:$PATH", if you've added it to your .bashrc then also do a source ~/.bashrc
  3. Clear both tabtab + yarn-completions using yarn global remove
  4. Install tabtab: yarn global add tabtab
  5. Install yarn-completions: yarn global add yarn-completions
  6. Run source ~/.bashrc or start a new shell and it should work.

Hope this helps!

  • I've seen some suggestions of using ~/.yarn-config, I don't think it matters as long as step 2 is correct and since ~/.config/yarn is already there I don't see any benefit of adding another yarn directory.

I got completions working following @gforge 's recipe but with one small adjustment, leaving it here in case it's useful to anyone else:
running yarn config set prefix ~/.config/yarn/global/bin actually caused the script to be linked in ~/.config/yarn/global/bin/bin/yarn-completions for me which caused completion to not work. I ran

yarn config set prefix ~/.config/yarn/global

instead and have completions working now!