From 33c91398bf9bfa6b5e449e9e94ee379b2970c9e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ma=C5=82ecki?= Date: Sat, 17 Sep 2011 13:16:37 +0200 Subject: [PATCH] Don't allow installing already installed version. Trying to install already installed version causes misleading message from curl and nvm: $ nvm install v0.4.11 curl: (33) HTTP server doesn't seem to support byte ranges. Cannot resume. nvm: install v0.4.11 failed! Of course, resuming interrupted installs is still possible (script checks for existance of `$VERSION` in `$NVM_DIR`, not `$NVM_DIR/src`). --- nvm.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nvm.sh b/nvm.sh index 0603b1a..2398134 100644 --- a/nvm.sh +++ b/nvm.sh @@ -108,6 +108,9 @@ nvm() fi [ "$NOCURL" ] && curl && return VERSION=`nvm_version $2` + + [ -d "$NVM_DIR/$VERSION" ] && echo "$VERSION is already installed." && return + tarball='' if [ "`curl -Is "http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz" | grep '200 OK'`" != '' ]; then tarball="http://nodejs.org/dist/$VERSION/node-$VERSION.tar.gz"