mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 14:21:50 +00:00
[Fix] make nvm use
display .nvmrc
's version in output messages
Set $PROVIDED_VERSION equals to $NVM_RC_VERSION only if a .nvmrc file is present and the user didn't provided a version to use (.ie typed `nvm use`). - Behavior before this fix : nvm use Found '.nvmrc' with version <v0.10.28> N/A: version "N/A" is not yet installed. You need to run "nvm install N/A" to install it before using it. - Behavior after this fix : nvm use Found '.nvmrc' with version <v0.10.28> N/A: version "v0.10.28" is not yet installed. You need to run "nvm install v0.10.28" to install it before using it.
This commit is contained in:
parent
59b0b3942c
commit
c0e6d8f332
5
nvm.sh
5
nvm.sh
@ -486,6 +486,11 @@ nvm_ensure_version_installed() {
|
||||
LOCAL_VERSION="$(nvm_version "${PROVIDED_VERSION}")"
|
||||
EXIT_CODE="$?"
|
||||
local NVM_VERSION_DIR
|
||||
|
||||
if [ "_$PROVIDED_VERSION" = "_N/A" ] && [ ! -d "$NVM_RC_VERSION" ] ; then
|
||||
PROVIDED_VERSION="$(nvm_ensure_version_prefix "$NVM_RC_VERSION")"
|
||||
fi
|
||||
|
||||
if [ "${EXIT_CODE}" != "0" ] || ! nvm_is_version_installed "${LOCAL_VERSION}"; then
|
||||
if VERSION="$(nvm_resolve_alias "${PROVIDED_VERSION}")"; then
|
||||
nvm_err "N/A: version \"${PROVIDED_VERSION} -> ${VERSION}\" is not yet installed."
|
||||
|
Loading…
Reference in New Issue
Block a user