From e01bcb740b4cfcfcd4a3cb4e30d0c3812d579d07 Mon Sep 17 00:00:00 2001 From: Andrew Crites Date: Thu, 9 Apr 2015 01:20:51 -0400 Subject: [PATCH] Include npm version when displaying results of switch. When running nvm use, successful changing of versions lists the new node version. The npm version may also be switched, but this is not listed. This commit updates nvm to display the npm version that was switched to alongside the node version --- nvm.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nvm.sh b/nvm.sh index ef9e67e..7b4a3e2 100755 --- a/nvm.sh +++ b/nvm.sh @@ -1360,10 +1360,10 @@ nvm() { if [ "_$VERSION" = '_system' ]; then if nvm_has_system_node && nvm deactivate >/dev/null 2>&1; then - echo "Now using system version of node: $(node -v 2>/dev/null)." + echo "Now using system version of node: $(node -v 2>/dev/null) (npm v$(npm --version 2>/dev/null))" return elif nvm_has_system_iojs && nvm deactivate >/dev/null 2>&1; then - echo "Now using system version of io.js: $(iojs --version 2>/dev/null)." + echo "Now using system version of io.js: $(iojs --version 2>/dev/null) (npm v$(npm --version 2>/dev/null))" return else echo "System version of node not found." >&2 @@ -1407,10 +1407,11 @@ nvm() { command rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current" fi if nvm_is_iojs_version "$VERSION"; then - echo "Now using io.js $(nvm_strip_iojs_prefix "$VERSION")" + echo -n "Now using io.js $(nvm_strip_iojs_prefix "$VERSION")" else - echo "Now using node $VERSION" + echo -n "Now using node $VERSION" fi + echo " (npm v$(npm --version 2>/dev/null))" ;; "run" ) local provided_version