Browse Source

[Fix] `nvm install`: Handle 'N/A' version instead of asking to install it

Fixes #1304.
Peter Dave Hello 8 years ago committed by Jordan Harband
parent
commit
8c03637023
No known key found for this signature in database
GPG Key ID: 64A196AEE0916D55
  1. 8
      nvm.sh

8
nvm.sh

@ -2626,10 +2626,14 @@ nvm() {
fi fi
return 8 return 8
fi 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 # This nvm_ensure_version_installed call can be a performance bottleneck
# on shell startup. Perhaps we can optimize it away or make it faster. # 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 $? return $?
fi fi

Loading…
Cancel
Save