lukechilds / zsh-nvm

Zsh plugin for installing, updating and loading nvm
MIT License
2.22k stars 112 forks source link

Unable to use "nvm upgrade" in oh-my-zsh #54

Closed snowman closed 5 years ago

snowman commented 5 years ago
➜  ~ zsh --version
x86_64-apple-darwin18.2.0

Install zsh-nvm with oh-my-zsh:
git clone https://github.com/lukechilds/zsh-nvm ~/.oh-my-zsh/custom/plugins/zsh-nvm
# Add to ~/.zshrc:
plugins=(
  git
  zsh-nvm
)

source $ZSH/oh-my-zsh.sh

After restart terminal:

$ nvm upgrade    # output same as run nvm without any option/value

but
$ _zsh_nvm_upgrade # work
lukechilds commented 5 years ago

Can you try commenting out where you're sourcing OMZ and source zsh-nvm directly?

So in .zshrc:

plugins=(
  git
  zsh-nvm
)

#source $ZSH/oh-my-zsh.sh
source ~/.oh-my-zsh/custom/plugins/zsh-nvm/zsh-nvm.plugin.zsh

Then open a new session and try:

nvm upgrade
snowman commented 5 years ago

same result, not work

snowman commented 5 years ago

i don't know whether this is relevant:

# FILE: ~/.zshrc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
lukechilds commented 5 years ago

It looks like you are loading nvm twice, once directly and once via zsh-nvm.

Can you comment those lines out and only load via zsh-nvm.

snowman commented 5 years ago

it works like a charm, thanks 👍

cat-walk commented 3 years ago

It looks like you are loading nvm twice, once directly and once via zsh-nvm.

Can you comment those lines out and only load via zsh-nvm.

It works for me too, thanks.