Fix `nvm reinstall-packages` for linked packages, broken in 7bce6c6c68

Jordan Harband 2015-07-02 22:45:11 -07:00
parent 3ef937a64e
commit be5e8de0c8
1 changed files with 6 additions and 2 deletions

8
nvm.sh
View File

@ -1765,14 +1765,18 @@ $NVM_LS_REMOTE_IOJS_OUTPUT" | command grep -v "N/A" | sed '/^$/d')"
echo "$INSTALLS" | command xargs npm install -g --quiet
local LINKS
LINKS="$(echo "$NPMLIST" | command sed -n 's/.* -> \(.*\)/\1/ p')" # | command sed -e '/^ *$/d;s/.*/"&"/')
LINKS="$(echo "$NPMLIST" | command sed -n 's/.* -> \(.*\)/\1/ p')"
echo "Linking global packages from $VERSION..."
for LINK in "$LINKS"; do
set -f; IFS='
' # necessary to turn off variable expansion except for newlines
for LINK in $LINKS; do
set +f; unset IFS # restore variable expansion
if [ -n "$LINK" ]; then
(cd "$LINK" && npm link)
fi
done
set +f; unset IFS # restore variable expansion in case $LINKS was empty
;;
"clear-cache" )
command rm -f $NVM_DIR/v* "$(nvm_version_dir)" 2>/dev/null