Using `nvm_version_greater` and `nvm_version_greater_than_or_equal_to` instead of `expr` in `nvm install`.

master
Jordan Harband 2014-09-19 10:10:37 -07:00
parent cb6456fd85
commit 5ef092b2c8
1 changed files with 3 additions and 3 deletions

6
nvm.sh
View File

@ -559,10 +559,10 @@ nvm() {
nvm use $VERSION nvm use $VERSION
if ! nvm_has "npm" ; then if ! nvm_has "npm" ; then
echo "Installing npm..." echo "Installing npm..."
if [ "`expr "$VERSION" : '\(^v0\.1\.\)'`" != '' ]; then if nvm_version_greater 0.2.0 "$VERSION"; then
echo "npm requires node v0.2.3 or higher" >&2 echo "npm requires node v0.2.3 or higher" >&2
elif [ "`expr "$VERSION" : '\(^v0\.2\.\)'`" != '' ]; then elif nvm_version_greater_than_or_equal_to "$VERSION" 0.2.0; then
if [ "`expr "$VERSION" : '\(^v0\.2\.[0-2]$\)'`" != '' ]; then if nvm_version_greater 0.2.3 "$VERSION"; then
echo "npm requires node v0.2.3 or higher" >&2 echo "npm requires node v0.2.3 or higher" >&2
else else
nvm_download https://npmjs.org/install.sh -o - | clean=yes npm_install=0.2.19 sh nvm_download https://npmjs.org/install.sh -o - | clean=yes npm_install=0.2.19 sh