From 990ad81419441d6a4f21b0d87b9232d246d45e03 Mon Sep 17 00:00:00 2001 From: "Jeffrey D. Van Alstine" Date: Thu, 17 Nov 2011 15:38:51 -0700 Subject: [PATCH 1/2] Check if node v0.1.x or v0.2.x before npm installs --- nvm.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nvm.sh b/nvm.sh index ba25641..debd227 100755 --- a/nvm.sh +++ b/nvm.sh @@ -115,7 +115,13 @@ nvm() if ! which npm ; then echo "Installing npm..." # TODO: if node version 0.2.x add npm_install=0.2.19 before sh - curl http://npmjs.org/install.sh | clean=yes sh + if [[ "`expr match $VERSION '\(^v0\.1\.\)'`" != '' ]]; then + echo "npm requires node v0.2.x or higher" + elif [[ "`expr match $VERSION '\(^v0\.2\.\)'`" != '' ]]; then + curl http://npmjs.org/install.sh | clean=yes npm_install=0.2.19 sh + else + curl http://npmjs.org/install.sh | clean=yes sh + fi fi else echo "nvm: install $VERSION failed!" From 18f4064003083685495687acd4e237721e6d1649 Mon Sep 17 00:00:00 2001 From: "Jeffrey D. Van Alstine" Date: Thu, 17 Nov 2011 16:15:31 -0700 Subject: [PATCH 2/2] Fixes npm version check for node v0.2.0, v0.2.1 and v0.2.2 --- nvm.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nvm.sh b/nvm.sh index debd227..6d589d8 100755 --- a/nvm.sh +++ b/nvm.sh @@ -114,11 +114,14 @@ nvm() nvm use $VERSION if ! which npm ; then echo "Installing npm..." - # TODO: if node version 0.2.x add npm_install=0.2.19 before sh if [[ "`expr match $VERSION '\(^v0\.1\.\)'`" != '' ]]; then - echo "npm requires node v0.2.x or higher" + echo "npm requires node v0.2.3 or higher" elif [[ "`expr match $VERSION '\(^v0\.2\.\)'`" != '' ]]; then - curl http://npmjs.org/install.sh | clean=yes npm_install=0.2.19 sh + if [[ "`expr match $VERSION '\(^v0\.2\.[0-2]$\)'`" != '' ]]; then + echo "npm requires node v0.2.3 or higher" + else + curl http://npmjs.org/install.sh | clean=yes npm_install=0.2.19 sh + fi else curl http://npmjs.org/install.sh | clean=yes sh fi