From 56c40cfa3cd17c37c1c7f56fe19580beb8e35db7 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 22 Aug 2014 02:19:56 -0700 Subject: [PATCH] Don't try to copy `npm` itself with `nvm copy-packages`. Fixes #504. --- nvm.sh | 2 +- test/slow/nvm copy-packages/should work as expected | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nvm.sh b/nvm.sh index 7f734fe..50e2586 100644 --- a/nvm.sh +++ b/nvm.sh @@ -791,7 +791,7 @@ nvm() { # declare local INSTALLS first, otherwise it doesn't work in zsh local INSTALLS - INSTALLS=$(nvm use $VERSION > /dev/null && npm list --global --parseable --depth=0 2> /dev/null | tail -n +2 | \grep -o -e '/[^/]*$' | cut -c 2- | xargs) + INSTALLS=$(nvm use $VERSION > /dev/null && npm list --global --parseable --depth=0 2> /dev/null | tail -n +2 | \grep -o -e '/[^/]*$' | cut -c 2- | \grep -v npm | xargs) npm install -g --quiet $INSTALLS ;; diff --git a/test/slow/nvm copy-packages/should work as expected b/test/slow/nvm copy-packages/should work as expected index 21f10df..2ba3efc 100755 --- a/test/slow/nvm copy-packages/should work as expected +++ b/test/slow/nvm copy-packages/should work as expected @@ -6,15 +6,15 @@ die () { echo "$@" ; exit 1; } nvm use 0.10.28 -EXPECTED_PACKAGES="autoprefixer bower david eslint grunt-cli grunth-cli http-server jshint marked node-gyp npm recursive-blame uglify-js yo" +EXPECTED_PACKAGES="autoprefixer bower david eslint grunt-cli grunth-cli http-server jshint marked node-gyp recursive-blame uglify-js yo" npm install -g --quiet $EXPECTED_PACKAGES nvm use 0.10.29 -ORIGINAL_PACKAGES=$(npm list --global --parseable --depth=0 2> /dev/null | tail -n +2 | grep -o -e '/[^/]*$' | cut -c 2- | sort | uniq | xargs) +ORIGINAL_PACKAGES=$(npm list --global --parseable --depth=0 2> /dev/null | tail -n +2 | \grep -o -e '/[^/]*$' | cut -c 2- | \grep -v npm | sort | uniq | xargs) nvm copy-packages 0.10.28 -FINAL_PACKAGES=$(npm list --global --parseable --depth=0 2> /dev/null | tail -n +2 | grep -o -e '/[^/]*$' | cut -c 2- | sort | uniq | xargs) +FINAL_PACKAGES=$(npm list --global --parseable --depth=0 2> /dev/null | tail -n +2 | \grep -o -e '/[^/]*$' | cut -c 2- | \grep -v npm | sort | uniq | xargs) [ "$FINAL_PACKAGES" = "$EXPECTED_PACKAGES" ] || die "final packages ($FINAL_PACKAGES) did not match expected packages ($EXPECTED_PACKAGES)" [ "$ORIGINAL_PACKAGES" != "$FINAL_PACKAGES" ] || die "original packages matched final packages ($ORIGINAL_PACKAGES)"