mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 10:15:53 +08:00 
			
		
		
		
	Fix nvm reinstall-packages for linked packages, broken in 7bce6c6c68
				
					
				
			This commit is contained in:
		
							
								
								
									
										8
									
								
								nvm.sh
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								nvm.sh
									
									
									
									
									
								
							| @@ -1765,14 +1765,18 @@ $NVM_LS_REMOTE_IOJS_OUTPUT" | command grep -v "N/A" | sed '/^$/d')" | |||||||
|       echo "$INSTALLS" | command xargs npm install -g --quiet |       echo "$INSTALLS" | command xargs npm install -g --quiet | ||||||
|  |  | ||||||
|       local LINKS |       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..." |       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 |         if [ -n "$LINK" ]; then | ||||||
|           (cd "$LINK" && npm link) |           (cd "$LINK" && npm link) | ||||||
|         fi |         fi | ||||||
|       done |       done | ||||||
|  |       set +f; unset IFS # restore variable expansion in case $LINKS was empty | ||||||
|     ;; |     ;; | ||||||
|     "clear-cache" ) |     "clear-cache" ) | ||||||
|       command rm -f $NVM_DIR/v* "$(nvm_version_dir)" 2>/dev/null |       command rm -f $NVM_DIR/v* "$(nvm_version_dir)" 2>/dev/null | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user