`nvm use system` should work as expected.
parent
9912f7cc46
commit
e7ada80d08
10
nvm.sh
10
nvm.sh
|
@ -549,9 +549,19 @@ nvm() {
|
||||||
if [ -n "$NVM_RC_VERSION" ]; then
|
if [ -n "$NVM_RC_VERSION" ]; then
|
||||||
VERSION=`nvm_version $NVM_RC_VERSION`
|
VERSION=`nvm_version $NVM_RC_VERSION`
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
if [ $2 = 'system' ]; then
|
||||||
|
if nvm_has_system_node && nvm deactivate; then
|
||||||
|
echo "Now using system version of node: $(node -v 2>/dev/null)."
|
||||||
|
return
|
||||||
|
else
|
||||||
|
echo "System version of node not found." >&2
|
||||||
|
return 127
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
VERSION=`nvm_version $2`
|
VERSION=`nvm_version $2`
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
if [ -z "$VERSION" ]; then
|
if [ -z "$VERSION" ]; then
|
||||||
nvm help
|
nvm help
|
||||||
return 127
|
return 127
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
die () { echo $@ ; exit 1; }
|
||||||
|
|
||||||
|
. ../../nvm.sh
|
||||||
|
|
||||||
|
nvm_has_system_node() { return 0; }
|
||||||
|
[ "$(nvm use system 2>&1 | tail -n1)" = "Now using system version of node: $(node -v)." ] || die "Could not use system version of node"
|
||||||
|
|
||||||
|
nvm_has_system_node() { return 1; }
|
||||||
|
[ "$(nvm use system 2>&1 | tail -n1)" = "System version of node not found." ] || die "Did not report error, system node not found"
|
||||||
|
nvm use system 2>&1 > /dev/null || [ $? -eq 127 ] || die "Did not return error code, system node not found"
|
||||||
|
|
Loading…
Reference in New Issue