Complete 13 command not found compdef

Cela dépend de ce que vous avez défini comme shell (de connexion) par défaut pour le système, pour Terminal, pour iTerm. La mise à jour de bash installée et configurée pour s'exécuter dans l'un d'entre eux donne des résultats différents.

Cette erreur provient d'un soi-disant fichier dot que vous avez installé. Ce sont des fichiers avec un point devant (d'où le nom) comme .bashrc . Cela signifie qu'ils sont invisibles pour le Finder et pour un simple ls . Les fichiers points en question sont lus par votre shell lors de son démarrage. Ils contiennent des instructions, des paramètres, des personnalisations; peut-être de petits extraits de code de programme.

Tous les fichiers à points du répertoire personnel de vos utilisateurs ne sont pas lus par le shell. Ceux lus par bash peuvent inclure: .bash_history .bash_profile .bash_prompt .bash_sessions .bashrc .editorconfig .exports .functions .inputrc .profile (Cette liste n'est pas exhaustive)

Ces fichiers peuvent avoir été créés par vous, manipulés par vous ou par certains programmes comme fink, homebrew ou ports. Vous venez de les copier depuis le net pour "mettre à jour" / personnaliser votre shell.

Quelle que soit la façon dont vous en êtes arrivé à la situation actuelle. Ouvrez votre Terminal / iTerm depuis un autre utilisateur et les symptômes ne seront probablement pas observés.

Cela signifie: tous ces fichiers sont en un sens «supprimés en toute sécurité»: dans le sens où ils ne sont pas essentiels pour faire fonctionner votre Terminal ou votre shell. Faites une sauvegarde de ceux-ci au cas où ils contiendraient effectivement des paramètres personnalisés dont vous pourriez dépendre dans votre travail quotidien. Des exemples pour cela incluent des ajouts à vos variables $ PATH . Sans ceux-ci, des programmes comme Fink ne fonctionnent plus.

Cependant, le message d'erreur que vous avez publié indique deux choses:

  • Le contenu combiné de vos fichiers de points n'a pas fonctionné pour accomplir ce qu'ils étaient censés faire. Plus exact: une instruction (compdef) a été appelée et n'est pas disponible.

  • Que vous avez très probablement obtenu un tas de fichiers à points à partir d'une source sur le net comme holman-dotfiles. Celles-ci comprenaient un bogue qui avait exactement le même message d'erreur.

Vous devriez donc parcourir tous les fichiers de points de votre utilisateur actuel et ne conserver que les éléments que vous reconnaissez comme nécessaires (rappelez-vous les sauvegardes).Ensuite, vous pouvez utiliser à nouveau les fichiers mis à jour de votre source.Mais gardez à l'esprit que ceux-ci sont assez «complets».Il serait prudent de ne pas les utiliser toutes aveuglément et de tester et de choisir un sous-ensemble de toutes ces options.

Les utiliser tous aveuglément ou sans discernement peut non seulement entraîner des problèmes tels que celui qui pose cette question, mais également lorsque vous suivez d'autres procédures ou conseils de dépannage.

Mise à jour: Cette réponse a été donnée à une version précédente de la question qui n'indiquait pas zsh comme shell utilisé.-> Remplacez zsh là où vous avez lu bash ci-dessus.

  •  
  • Published Linked with GitHub

  • Like1 Bookmark Subscribe

# complete:13: command not found: compdef ###### tags: `Tools` ## 問題: ``` complete:13: command not found: compdef ``` ## 解決: ``` autoload -Uz compinit compinit ```


Published on HackMD

7

Like1 Bookmark Subscribe

1

    Sign in

    Email

    Password

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox

    New to HackMD? Sign up

    Questions : Why cant zsh execute command compdef

    2022-09-26T06:45:12+00:00 2022-09-26T06:45:12+00:00

    638

    I have installed zsh and oh my zsh on Ubuntu anycodings_kubectl 18.04. I would like to use autocompletion anycodings_kubectl for kubectl. Therefore I have added source anycodings_kubectl <(kubectl completion zsh) to my ~/.zshrc anycodings_kubectl file.

    On execution of this script zsh gets the anycodings_kubectl following error:

    complete:13: command not found: compdef
    

    The kubectl documentation states that when anycodings_kubectl one gets the error above, you should put the anycodings_kubectl following on top of the .zshrc file:

    autoload -Uz compinit
    compinit
    

    After doing this and restarting the anycodings_kubectl terminal, I get the same error.

    In a git-issue I found the following helped anycodings_kubectl people with a common issue:

    #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
    

    zsh logs the following while running the anycodings_kubectl script:

    kubescript:12457: command not found: _bash_comp
    

    Unfortunately this did not solve my problem. anycodings_kubectl What else can I do to fix my issue? Or even anycodings_kubectl still: what can I do to find out what is anycodings_kubectl causing it?

    Total Answers 8

    32

    Answers 1 : of Why cant zsh execute command compdef

    I fixed the error by using the following anycodings_kubectl code in .zshrc:

    # K8s auto-complete
    autoload -U +X compinit && compinit
    source <(kubectl completion zsh)
    

    You may also do it using oh-my-zsh anycodings_kubectl plugin if you use oh-my-zsh.

    0

    2022-09-26T06:45:12+00:00 2022-09-26T06:45:12+00:00Answer Link

    mRahman

    5

    Answers 2 : of Why cant zsh execute command compdef

    I had the same issue and it was solved anycodings_kubectl updating nvm

    $ curl -o- anycodings_kubectl https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh anycodings_kubectl | bash

    0

    2022-09-26T06:45:12+00:00 2022-09-26T06:45:12+00:00Answer Link

    joy

    4

    Answers 3 : of Why cant zsh execute command compdef

    For my OSX 10.15.7 I did something anycodings_kubectl similar

    vi ~/.zshrc
    
    alias k=kubectl
    autoload -U +X compinit && compinit
    [[ /usr/local/bin/kubectl ]] && source <(kubectl completion zsh)
    

    Works like a charm!

    0

    2022-09-26T06:45:12+00:00 2022-09-26T06:45:12+00:00Answer Link

    miraj

    4

    Answers 4 : of Why cant zsh execute command compdef

    After trying lot of options and going anycodings_kubectl through diff treads. It worked for me anycodings_kubectl after running below command

    autoload -Uz compinstall && compinstall
    

    This configures the ~/.zshrc and anycodings_kubectl initialize the compinit by adding these anycodings_kubectl 2 below lines:

    autoload -Uz compinit
    compinit
    

    and then run below sudo commands which anycodings_kubectl mentioned in link

    $ sudo chmod -R 755 /usr/local/share/zsh
    $ sudo chown -R root:staff /usr/local/share/zsh
    $ compaudit | xargs chmod g-w
    

    at last restart the terminal.

    Hope this helps for someone.

    0

    2022-09-26T06:45:12+00:00 2022-09-26T06:45:12+00:00Answer Link

    jidam

    1

    Answers 5 : of Why cant zsh execute command compdef

    In my case the issue was fixed after anycodings_kubectl re-installing oh-my-zsh:

    1. Deleted my old version rm -rf ~/.oh-my-zsh
    2. Installed from https://github.com/ohmyzsh/ohmyzsh

    0

    2022-09-26T06:45:12+00:00 2022-09-26T06:45:12+00:00Answer Link

    joy

    1

    Answers 6 : of Why cant zsh execute command compdef

    I really tried every answer here, but anycodings_kubectl nothing worked.

    So, I tried this tutorial paying anycodings_kubectl attention to the last observation:

    "Note: Make sure you add this snippet anycodings_kubectl before any call to compdef else you will anycodings_kubectl still see the error"

    I had a complete call from Terraform anycodings_kubectl installation in my ~/.zshrc and anycodings_kubectl ~/.bash_profile files.

    https://thysmichels.com/2020/07/16/mac-solved-command-not-found-compdef/

    0

    2022-09-26T06:45:12+00:00 2022-09-26T06:45:12+00:00Answer Link

    jidam

    4

    Answers 7 : of Why cant zsh execute command compdef

    For me I had this line:

    source ~/.oh-my-zsh/plugins/git/git.plugin.zsh
    

    In my ~/.zshrc file. Which was trying to anycodings_kubectl source the plugin before it is loaded by anycodings_kubectl plugins=(git)

    Removing that line fixed it for me.

    If you have added the plugins and anycodings_kubectl everything works well, One of the anycodings_kubectl reasons is you may be trying to use the anycodings_kubectl plugin before it is loaded. As in my anycodings_kubectl case.

    0

    2022-09-26T06:45:12+00:00 2022-09-26T06:45:12+00:00Answer Link

    joy

    1

    Answers 8 : of Why cant zsh execute command compdef

    I encountered this after installing the anycodings_kubectl Angular CLI. Turns that Angular adds anycodings_kubectl something into your .zshrc file.

    If you recently installed Angular CLI, anycodings_kubectl open ~/.zshrc and remove the lines added anycodings_kubectl by Angular CLI.

    0

    2022-09-26T06:45:12+00:00 2022-09-26T06:45:12+00:00Answer Link

    raja