From 4b3d6f1760b3e3e867d892360cee36622995997c Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Fri, 22 Aug 2014 02:44:04 -0700 Subject: [PATCH] Properly pass a space-separated list of packages to `npm install` Fixes #490. --- nvm.sh | 2 +- test/slow/nvm copy-packages/should work as expected | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nvm.sh b/nvm.sh index 50e2586..dd4ea74 100644 --- a/nvm.sh +++ b/nvm.sh @@ -793,7 +793,7 @@ nvm() { 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- | \grep -v npm | xargs) - npm install -g --quiet $INSTALLS + echo "$INSTALLS" | xargs npm install -g --quiet ;; "clear-cache" ) rm -f $NVM_DIR/v* "$(nvm_version_dir)" 2>/dev/null diff --git a/test/slow/nvm copy-packages/should work as expected b/test/slow/nvm copy-packages/should work as expected index 2ba3efc..66859eb 100755 --- a/test/slow/nvm copy-packages/should work as expected +++ b/test/slow/nvm copy-packages/should work as expected @@ -8,7 +8,7 @@ nvm use 0.10.28 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 +echo "$EXPECTED_PACKAGES" | xargs npm install -g --quiet 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- | \grep -v npm | sort | uniq | xargs)