mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 10:15:53 +08:00 
			
		
		
		
	use a subshell instead of setting the START var
also don't try to install npm if node installation fails.
This commit is contained in:
		
				
					committed by
					
						 Tim Caswell
						Tim Caswell
					
				
			
			
				
	
			
			
			
						parent
						
							8e0406e95b
						
					
				
				
					commit
					d13d6b199a
				
			
							
								
								
									
										12
									
								
								nvm.sh
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								nvm.sh
									
									
									
									
									
								
							| @@ -36,21 +36,25 @@ nvm() | ||||
|         nvm help | ||||
|         return; | ||||
|       fi | ||||
|       START=`pwd` | ||||
|       mkdir -p "$NVM_DIR/src" && \ | ||||
|       if ( | ||||
|         mkdir -p "$NVM_DIR/src" && | ||||
|         cd "$NVM_DIR/src" && \ | ||||
|         wget "http://nodejs.org/dist/node-$2.tar.gz" -N && \ | ||||
|         tar -xzf "node-$2.tar.gz" && \ | ||||
|         cd "node-$2" && \ | ||||
|         ./configure --prefix="$NVM_DIR/$2" && \ | ||||
|         make && \ | ||||
|       make install && \ | ||||
|         make install | ||||
|         ) | ||||
|       then | ||||
|         nvm use $2 | ||||
|         if ! which npm ; then | ||||
|           echo "Installing npm..." | ||||
|           curl http://npmjs.org/install.sh | sh | ||||
|         fi | ||||
|       cd $START | ||||
|       else | ||||
|         echo "nvm: install $2 failed!" | ||||
|       fi | ||||
|     ;; | ||||
|     "deactivate" ) | ||||
|       if [[ $PATH == *$NVM_DIR/*/bin* ]]; then | ||||
|   | ||||
		Reference in New Issue
	
	Block a user