Skip to content
Myr

Merge pull request #722 from ajcrites/list-npm-version

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Include npm version when displaying results of switch.

authored by Jordan Harband · committed by Jordan Harband · parents 276d55c, e4149c3 · Browse files · 2 files+13 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+13 added−5 removed

  • tests:+1 added−1 removed
  • other:+12 added−4 removed

2 files+13 added−5 removed

modified:test/fast/Running "nvm use system" should work as expected+1 added-1 removed
3 unmodified lines
45. ../../nvm.sh67nvm_has_system_node() { return 0; }8[ "$(nvm use system 2>&1 | tail -n1)" = "Now using system version of node: $(node -v)." ] || die "Could not use system version of node"8[ "$(nvm use system 2>&1 | tail -n1)" = "Now using system version of node: $(node -v) (npm v$(npm -v))" ] || die "Could not use system version of node"910nvm_has_system_node() { return 1; }11[ "$(nvm use system 2>&1 | tail -n1)" = "System version of node not found." ] || die "Did not report error, system node not found"12nvm use system 2>&1 > /dev/null || [ $? -eq 127 ] || die "Did not return error code, system node not found"
1 unmodified line
modified:nvm.sh+12 added-4 removed
1357 unmodified lines
1358 return 1271359 fi13601361 if [ "_$VERSION" = '_system' ]; then1362 local NPM_VERSION1363 if nvm_has "npm"; then1364 NPM_VERSION="(npm v$(npm --version 2>/dev/null))"1365 fi1366 if nvm_has_system_node && nvm deactivate >/dev/null 2>&1; then1363 echo "Now using system version of node: $(node -v 2>/dev/null)."1367 echo "Now using system version of node: $(node -v 2>/dev/null) $NPM_VERSION"1368 return1369 elif nvm_has_system_iojs && nvm deactivate >/dev/null 2>&1; then1366 echo "Now using system version of io.js: $(iojs --version 2>/dev/null)."1370 echo "Now using system version of io.js: $(iojs --version 2>/dev/null) $NPM_VERSION"1371 return1372 else1373 echo "System version of node not found." >&21374 return 127
34 unmodified lines
1409 export NVM_BIN="$NVM_VERSION_DIR/bin"1410 if [ "$NVM_SYMLINK_CURRENT" = true ]; then1411 command rm -f "$NVM_DIR/current" && ln -s "$NVM_VERSION_DIR" "$NVM_DIR/current"1412 fi1413 local NPM_VERSION1414 if nvm_has "npm"; then1415 NPM_VERSION="(npm v$(npm --version 2>/dev/null))"1416 fi1417 if nvm_is_iojs_version "$VERSION"; then1410 echo "Now using io.js $(nvm_strip_iojs_prefix "$VERSION")"1418 echo "Now using io.js $(nvm_strip_iojs_prefix "$VERSION") $NPM_VERSION"1419 else1412 echo "Now using node $VERSION"1420 echo "Now using node $VERSION $NPM_VERSION"1421 fi1422 ;;1423 "run" )1424 local provided_version
345 unmodified lines