2016-04-19 05:08:40 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2016-11-07 03:34:36 +08:00
|
|
|
die () { echo "$@" ; exit 1; }
|
2016-04-19 05:08:40 +08:00
|
|
|
|
|
|
|
# Source nvm
|
2016-11-04 13:15:18 +08:00
|
|
|
\. ../../../nvm.sh
|
2016-04-19 05:08:40 +08:00
|
|
|
|
|
|
|
# Version to install/uninstall
|
|
|
|
NVM_TEST_VERSION=5.10.1
|
|
|
|
|
|
|
|
# Make sure it's not already here
|
|
|
|
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
|
|
|
|
|
|
|
# Install it
|
|
|
|
nvm install $NVM_TEST_VERSION
|
|
|
|
|
|
|
|
# Make sure it installed
|
|
|
|
nvm ls | grep "$NVM_TEST_VERSION" || die "Failed to install node"
|
|
|
|
|
|
|
|
# Install global module as root
|
|
|
|
npm_path=$(which npm)
|
2019-05-05 04:34:16 +08:00
|
|
|
sudo -n "$npm_path" install jspm@'<2' -g || die 'either sudo failed, or `npm install jspm -g` failed`'
|
2016-04-19 05:08:40 +08:00
|
|
|
|
|
|
|
# Switch to another version so we can uninstall
|
|
|
|
nvm use 0.12.7
|
|
|
|
|
|
|
|
# Attempt to uninstall it
|
|
|
|
RETURN_MESSAGE="$(nvm uninstall $NVM_TEST_VERSION 2>&1)"
|
|
|
|
CHECK_FOR="Cannot uninstall, incorrect permissions on installation folder"
|
|
|
|
test "${RETURN_MESSAGE#*$CHECK_FOR}" != "$RETURN_MESSAGE" || die "Failed to show error message"
|