[Docs] [Fix] zsh autochange: only nvm install if we can’t nvm use

This commit is contained in:
butlerx 2016-12-19 12:00:47 +00:00 committed by Jordan Harband
parent 40e40975eb
commit f1a5f2a15f
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55

View File

@ -322,8 +322,10 @@ load-nvmrc() {
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" != "N/A" ] && [ "$nvmrc_node_version" != "$node_version" ]; then
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
elif [ "$nvmrc_node_version" != "$node_version" ]; then
nvm use
fi
elif [ "$node_version" != "$(nvm version default)" ]; then
echo "Reverting to nvm default version"