diff --git a/nvm.sh b/nvm.sh index c4a948f565b..a0c451f472c 100644 --- a/nvm.sh +++ b/nvm.sh @@ -163,7 +163,11 @@ nvm_is_version_installed() { nvm_print_npm_version() { if nvm_has "npm"; then - command printf " (npm v$(npm --version 2>/dev/null))" + local NPM_VERSION + NPM_VERSION="$(npm --version 2>/dev/null)" + if [ -n "${NPM_VERSION}" ]; then + command printf " (npm v${NPM_VERSION})" + fi fi } @@ -1130,7 +1134,7 @@ nvm_ls_current() { if [ "${VERSION}" = "v0.6.21-pre" ]; then nvm_echo 'v0.6.21' else - nvm_echo "${VERSION}" + nvm_echo "${VERSION:-none}" fi else nvm_echo 'system'