Only print npm version if it exists

master
Andrew Crites 2015-04-09 02:31:57 -04:00
parent caa69bc500
commit e4149c380b
1 changed files with 6 additions and 2 deletions

4
nvm.sh
View File

@ -1360,7 +1360,9 @@ nvm() {
if [ "_$VERSION" = '_system' ]; then if [ "_$VERSION" = '_system' ]; then
local NPM_VERSION local NPM_VERSION
if nvm_has "npm"; then
NPM_VERSION="(npm v$(npm --version 2>/dev/null))" NPM_VERSION="(npm v$(npm --version 2>/dev/null))"
fi
if nvm_has_system_node && nvm deactivate >/dev/null 2>&1; 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) $NPM_VERSION" echo "Now using system version of node: $(node -v 2>/dev/null) $NPM_VERSION"
return return
@ -1409,7 +1411,9 @@ nvm() {
command rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current" command rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current"
fi fi
local NPM_VERSION local NPM_VERSION
if nvm_has "npm"; then
NPM_VERSION="(npm v$(npm --version 2>/dev/null))" NPM_VERSION="(npm v$(npm --version 2>/dev/null))"
fi
if nvm_is_iojs_version "$VERSION"; then if nvm_is_iojs_version "$VERSION"; then
echo "Now using io.js $(nvm_strip_iojs_prefix "$VERSION") $NPM_VERSION" echo "Now using io.js $(nvm_strip_iojs_prefix "$VERSION") $NPM_VERSION"
else else