title: Why can't zsh execute command compdef?
body: <p>I have installed zsh and oh my zsh on Ubuntu 18.04. I would like to use autocompletion for kubectl. Therefore I have added <code>source &lt;(kubectl completion zsh)</code> to my ~/.zshrc file.</p>
  
  <p>On execution of this script zsh gets the following error:</p>
  
  <pre><code>complete:13: command not found: compdef
  </code></pre>
  
  <p>The kubectl documentation states that when one gets the error above, you should put the following on top of the .zshrc file:</p>
  
  <pre><code>autoload -Uz compinit
  compinit
  </code></pre>
  
  <p>After doing this and restarting the terminal, I get the same error. </p>
  
  <p>In a git-issue I found the following helped people with a common issue: </p>
  
  <pre><code>#This will perform chmod g-w for each file returned by compaudit to remove write access for group
  compaudit | xargs -I % chmod g-w "%"
  #This will perform chown to current user (Windows and Linux) for each file returned by compaudit
  compaudit | xargs -I % chown $USER "%"
  #Remove all dump files (which normally speed up initialization)
  rm ~/.zcompdump*
  #Regenerate completions file
  compinit
  </code></pre>
  
  <p>zsh logs the following while running the script:</p>
  
  <pre><code>kubescript:12457: command not found: _bash_comp
  </code></pre>
  
  <p>Unfortunately this did not solve my problem. What else can I do to fix my issue? Or even still: what can I do to find out what is causing it?</p>