dsifford/yarn-completion

command not found: _init_completion; command not found: _get_comp_words_by_ref

andriyslyusar opened this issue · 10 comments

I have next error using yarn completion (zsh as shell).

 yarn _yarn:78: command not found: _init_completion
_yarn:80: command not found: _get_comp_words_by_ref
$ bash --version
GNU bash, version 4.4.12(1)-release (x86_64-apple-darwin16.3.0)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

@andreyslyusar Thanks for the report!

Do you mind sharing your .zshrc file so I can take a peek at it?

@andreyslyusar v0.2.1 should fix the problem. There's a couple of things you need to add to your ~/.zshrc for it to work properly. Check the readme for those details.

@dsifford Thanks a lot for help. Sorry for late response.

Hey there I'm getting a similar error but am on bash and not zsh:

I get this when I try to hit tab and autocomplete a yarn run open command:
yarn run op-bash: _get_comp_words_by_ref: command not found

Any ideas why this might be failing?

Thanks!

@tnrich Which version of bash? Are you on mac OS? Do you have bash-completion installed?

Mac OS comes preinstalled with bash 3.x.x and they're stuck at that version because (if I recall correctly) bash 4 switched to a license that doesn't agree with Mac OS's license.

If you're on bash 3, that shouldn't be an issue if you have bash-completion installed.

If you have homebrew you can upgrade or install one or both of those things and that should solve your issue. (If you do decide to upgrade to bash 4, which I would recommend, don't forget to chsh and add it as your login shell)

@dsifford I don't know if I have bash-completion installed. I didn't realize that was a pre-requisite. I am on a Mac and my bash version is: 3.2.57(1)-release

@tnrich bash-completion shouldn't technically be a prerequisite. You might just be using a version of bash that predates the _get_comp_words_by_ref function which has been added to bash proper in the later versions of bash 3.

I'll adjust the readme later on to reflect this.

@dsifford I'm getting the same error using zsh and oh-my-zsh on Mac. Any ideas?

@andreyslyusar What version of zsh are you running?

Did you autoload and run compinit and bashcompinit prior to sourcing the completion file in your zshrc, like the readme suggests?