Merge pull request #83 from jeffv/master

Fixes npm install to check version before running
master
Tim Caswell 2011-11-17 16:07:14 -08:00
commit ec2327fddd
1 changed files with 11 additions and 2 deletions

11
nvm.sh
View File

@ -114,9 +114,18 @@ 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.3 or higher"
elif [[ "`expr match $VERSION '\(^v0\.2\.\)'`" != '' ]]; then
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
fi
else
echo "nvm: install $VERSION failed!"
fi