Skip to content

Commit

Permalink
[Fix] nvm install: Handle 'N/A' version instead of asking to instal…
Browse files Browse the repository at this point in the history
…l it

Fixes #1304.
  • Loading branch information
PeterDaveHello authored and ljharb committed Nov 14, 2016
1 parent fd33179 commit fc7befc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2626,10 +2626,14 @@ nvm() {
fi
return 8
fi

if [ "${VERSION}" = 'N/A' ]; then
nvm_err "N/A: version \"${PROVIDED_VERSION} -> ${VERSION}\" is not yet installed."
nvm_err ""
nvm_err "You need to run \"nvm install ${PROVIDED_VERSION}\" to install it before using it."
return 3
# This nvm_ensure_version_installed call can be a performance bottleneck
# on shell startup. Perhaps we can optimize it away or make it faster.
if ! nvm_ensure_version_installed "${VERSION}"; then
elif ! nvm_ensure_version_installed "${VERSION}"; then
return $?
fi

Expand Down

0 comments on commit fc7befc

Please sign in to comment.