Skip to content

Commit 0e9fde7

Browse files
committed
fixes #46
1 parent 4012206 commit 0e9fde7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

node-reinstall

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# credit: http://stackoverflow.com/a/11178106/2083544
44

55
## program version
6-
VERSION="0.0.17"
6+
VERSION="0.0.18"
77

88
## path prefix
99
PREFIX="${PREFIX:-/usr/local}"
@@ -185,9 +185,12 @@ sudo rm -rf $PREFIX/lib/dtrace/node.d
185185
if (( $USE_NVM )); then
186186
# go home and install NVM just because I feel safe there
187187
cd $HOME
188-
# get the latest stable version number of nvm from the repo's homepage
189-
[ "$STABLE" == "" ] && STABLE=$(curl -s -k https://github.com/creationix/nvm/ | grep "curl https://raw.githubusercontent.com/creationix/nvm/" | grep -oE "v\d+\.\d+\.\d+")
190-
[[ $STABLE =~ ^v[0-9]+.[0-9]+.[0-9]+$ ]] || STABLE="v0.25.1"
188+
# get the latest stable version number of nvm from the repo's package.json
189+
# credit to https://unix.stackexchange.com/a/166360/107211 and
190+
# credit to https://stackoverflow.com/a/6852427/2083544
191+
[ "$STABLE" == "" ] && STABLE_WITHOUT_V=$(curl -v --silent https://raw.githubusercontent.com/creationix/nvm/master/package.json 2>&1 | grep -Eo '"version":.*?[^\\]",' | perl -pe 's/"version": //; s/^"//; s/",$//')
192+
[ -n $STABLE_WITHOUT_V ] && [[ $STABLE_WITHOUT_V =~ ^[0-9]+.[0-9]+.[0-9]+$ ]] && STABLE="v${STABLE_WITHOUT_V}"
193+
[[ $STABLE =~ ^v[0-9]+.[0-9]+.[0-9]+$ ]] || STABLE="v0.33.11"
191194
curl -sL https://raw.githubusercontent.com/creationix/nvm/$STABLE/install.sh | bash
192195
source $HOME/.nvm/nvm.sh
193196
elif (( $USE_NAVE )); then

0 commit comments

Comments
 (0)