From 2f3f7dfc4e7a5e14a80af4088c487cca3ec6ab0b Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Tue, 3 Jan 2017 21:30:39 +0700 Subject: [PATCH] Install node version from .nvmrc if we don't have it --- zsh-nvm.plugin.zsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zsh-nvm.plugin.zsh b/zsh-nvm.plugin.zsh index a968aca..9eb98bb 100644 --- a/zsh-nvm.plugin.zsh +++ b/zsh-nvm.plugin.zsh @@ -161,9 +161,10 @@ _zsh_nvm_auto_use() { 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 - nvm use - export NVM_AUTO_USE_ACTIVE=true + if [[ "$nvmrc_node_version" != "N/A" ]]; then + [[ "$nvmrc_node_version" != "$node_version" ]] && nvm use && export NVM_AUTO_USE_ACTIVE=true + else + nvm install && export NVM_AUTO_USE_ACTIVE=true fi elif [[ "$node_version" != "$(nvm version default)" ]] && [[ "$NVM_AUTO_USE_ACTIVE" = true ]]; then echo "Reverting to nvm default version"