From 56e32888ea6e93de1befbda688f9b5ee56c6e620 Mon Sep 17 00:00:00 2001 From: "D. Stuart Freeman" Date: Thu, 12 Dec 2013 10:52:43 -0500 Subject: [PATCH] fix copy-packages --- nvm.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nvm.sh b/nvm.sh index f59c99f..45876ba 100755 --- a/nvm.sh +++ b/nvm.sh @@ -484,9 +484,10 @@ nvm() { nvm help return fi - VERSION=`nvm_version $2` - ROOT=`nvm use $VERSION && npm -g root` - INSTALLS=`nvm use $VERSION > /dev/null && npm -g -p ll | \grep "$ROOT\/[^/]\+$" | cut -d '/' -f 8 | cut -d ":" -f 2 | \grep -v npm | tr "\n" " "` + local VERSION=`nvm_version $2` + local ROOT=`nvm use $VERSION && npm -g root` + local ROOTDEPTH=$((`echo $ROOT | sed 's/[^\/]//g'|wc -m` -1)) + local INSTALLS=`nvm use $VERSION > /dev/null && npm -g -p ll | \grep "$ROOT\/[^/]\+$" | cut -d '/' -f $(($ROOTDEPTH + 2)) | cut -d ":" -f 2 | \grep -v npm | tr "\n" " "` npm install -g $INSTALLS ;; "clear-cache" )