iTerm2 start with complete:13: command not found

dongchaochen profile image Dongchao (Alan) Chen ・1 min read

Recently when I open my iTerm2, I got the message complete:13: command not found: compdef, where it is coming from?
Alt Text

After some research, the answer is in my ~/.zshrc
these two lines are added when I recently re-install nodejs using nvm, you can find this info from nvm readme - Git install section
Alt Text
But it is in zsh, so no need to load nvm bash_completion, comment out the line [-s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion will solve the problem.
Alt Text
Now re-open a new session, error message is gone.
Alt Text


Editor guide