Closed idkjs closed 7 years ago
usually, cli tools will add something to your shell rc file as part of the install process--and it looks like it did do something of that sort since your shell is trying to load /Users/devworx/lib/azure-cli/az.completion when you open a new tab.
It looks like this may be a bug in the azure-cli with support for the version of zsh that you have installed: https://github.com/Azure/azure-cli/issues/1722
berndverst commented on Feb 5
I just noticed that zsh version 5.2 is not the latest. For some reason I wasn't managing it via homebrew, so I updated my install with brew install zsh. Now running zsh 5.3.1 (x86_64-apple-darwin16.3.0) I no longer get this error.
@niemyjski perhaps upgrading your zsh will fix this for you too? 🤷♂️
I checked the version and its correct. So from your answer, you would expect that a new npm install would get you access to an executable without having to do anything else. It doesnt seem to be working so smoothly for me.
I wouldn't expect this to be an npm issue--the azure cli is outside of npm. The problem points to this line: https://github.com/Azure/azure-cli/blob/1271aa0cad486b8c61cc788c912f3e87092bb104/packaged_releases/az.completion#L21
The complete
command/function doesn't exist.
Did you try adding: autoload bashcompinit && bashcompinit
to .zshrc before the line sourcing azure-cli/az.completion
?
:tldr @atomantic is a generous genius. :whole story: I guess we are getting to the heart of it. I didnt source azure-cli/az.completion in .zshrc. Im not clear on the steps for adding a new package to this set up. So from the sounds of it, the steps generally to 1. Run the install 2. Add a script sourcing the new executable to your .rc file. In this case, its .zshrc because we are using the .zsh shell. 3. Reset terminal (exec $SHELL or open new terminal).
In this specific case it looks like this. This worked successfully.
curl -L https://aka.ms/InstallAzureCli | bash
.
//output of #1
azure-cli directory: '/Users/devworx/lib/azure-cli'
===> In what directory would you like to place the 'az' executable? (leave blank to use '/Users/devworx/bin'): //left blank
exec -l $SHELL
to restart your shell. -- Installation successful. -- Run the CLI with /Users/devworx/bin/az --help
This is the newly generated .zshrc
~ cat ~/.zshrc ✓ 1095 10:04:56
export ZSH=$HOME/.dotfiles/oh-my-zsh
export ZSH_THEME="powerlevel9k/powerlevel9k" POWERLEVEL9K_SHORTEN_DIR_LENGTH=2
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir nvm vcs) POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status history time)
POWERLEVEL9K_NVM_FOREGROUND='000' POWERLEVEL9K_NVM_BACKGROUND='072' POWERLEVEL9K_SHOW_CHANGESET=true
export CASE_SENSITIVE="true"
export DISABLE_AUTO_TITLE="true"
plugins=(colorize compleat dirpersist autojump git gulp history cp)
source $ZSH/oh-my-zsh.sh
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
source /usr/local/opt/nvm/nvm.sh
autoload -U add-zsh-hook load-nvmrc() { if [[ -f .nvmrc && -r .nvmrc ]]; then nvm use &> /dev/null elif [[ $(nvm version) != $(nvm version default) ]]; then nvm use default &> /dev/null fi } add-zsh-hook chpwd load-nvmrc load-nvmrc
unsetopt correct
fortune
export PATH=$PATH:/Users/devworx/bin
source '/Users/devworx/lib/azure-cli/az.completion'
Running `exec -l $SHELL` gets the command not found error.
```bash
Use the Force, Luke.
/Users/devworx/lib/azure-cli/az.completion:10: command not found: complete
Then followed your instruction adding 'autoload bashcompinit && bashcompinit '(even though i have no idea what that is, will research)
~ nvim ~/.zshrc 127 ↵ 1096 10:06:18
...
autoload bashcompinit && bashcompinit
source '/Users/devworx/lib/azure-cli/az.completion'
....
~ exec -l $SHELL
Then run az
:
az ✓ 1099 10:08:29
/\
/ \ _____ _ _ __ ___
/ /\ \ |_ / | | | \'__/ _ \
/ ____ \ / /| |_| | | | __/
/_/ \_\/___|\__,_|_| \___|
Welcome to the cool new Azure CLI!
Here are the base commands:
account : Manage subscriptions.
....
I figured I would leave this here in case it helps anyone else. Thus the details...
So @atomantic, I very much appreciate you sharing this. Clearly you have a helpful soul. I'm trying to dig into this and understand how to get control of my mac for dev. I have installed azure-cli with this script. I then get this error
/Users/devworx/lib/azure-cli/az.completion:10: command not found: complete
, screenshot:This azure-cli issue suggests a method to correct this error however, I am trying understand how you would do it. My first thought is to add it to ~./shellpaths. More generally, is there a built in script for adding new items installed via curl to the path? If not how would you do it. Thank you.