Skip to content
Myr

Making `nvm install` use the version, even if it's already installed. Fixes #410

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jordan Harband · committed by Jordan Harband · parent 29f5826 · Browse files · 2 files+29 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+29 added−1 removed

  • tests:+24 added−0 removed
  • other:+5 added−1 removed

2 files+29 added−1 removed

added:test/slow/nvm install/install already installed uses it+24 added
1#!/bin/sh23die () { echo $@ ; exit 1; }45. ../../../nvm.sh67[ "$(nvm install invalid.invalid)" = "Version 'invalid.invalid' not found - try \`nvm ls-remote\` to browse available versions." ] || die "nvm installing an invalid version did not print a nice error message"89# Remove the stuff we're clobbering.10[ -e ../../../v0.9.7 ] && rm -R ../../../v0.9.711[ -e ../../../v0.9.12 ] && rm -R ../../../v0.9.121213# Install from binary14nvm install 0.9.715nvm install 0.9.121617nvm use 0.9.71819node --version | grep v0.9.7 || die "precondition failed: node doesn't start at 0.9.7"2021nvm install 0.9.122223node --version | grep v0.9.12 || die "nvm install on already installed version doesn't use it"24
modified:nvm.sh+5 added-1 removed
304 unmodified lines
305 ADDITIONAL_PARAMETERS="$ADDITIONAL_PARAMETERS $1"306 shift307 done308309 [ -d "$NVM_DIR/$VERSION" ] && echo "$VERSION is already installed." && return309 if [ -d "$NVM_DIR/$VERSION" ]; then310 echo "$VERSION is already installed."311 nvm use "$VERSION"312 return $?313 fi314315 if [ "$VERSION" = "N/A" ]; then316 echo "Version '$provided_version' not found - try \`nvm ls-remote\` to browse available versions."317 return 3
315 unmodified lines