Ensure that `nvm use` works when .nvmrc contains "system"
parent
d5fe657382
commit
804f2759f8
22
nvm.sh
22
nvm.sh
|
@ -666,8 +666,17 @@ nvm() {
|
|||
if [ -n "$NVM_RC_VERSION" ]; then
|
||||
VERSION=`nvm_version $NVM_RC_VERSION`
|
||||
fi
|
||||
elif [ "_$2" != '_system' ]; then
|
||||
VERSION="$(nvm_version "$2")"
|
||||
else
|
||||
if [ $2 = 'system' ]; then
|
||||
VERSION="$2"
|
||||
fi
|
||||
if [ -z "$VERSION" ]; then
|
||||
nvm help
|
||||
return 127
|
||||
fi
|
||||
|
||||
if [ "_$VERSION" = '_system' ]; then
|
||||
if nvm_has_system_node && nvm deactivate >/dev/null; then
|
||||
echo "Now using system version of node: $(node -v 2>/dev/null)."
|
||||
return
|
||||
|
@ -675,17 +684,8 @@ nvm() {
|
|||
echo "System version of node not found." >&2
|
||||
return 127
|
||||
fi
|
||||
else
|
||||
VERSION=`nvm_version $2`
|
||||
fi
|
||||
fi
|
||||
if [ -z "$VERSION" ]; then
|
||||
nvm help
|
||||
return 127
|
||||
fi
|
||||
if [ -z "$VERSION" ]; then
|
||||
VERSION=`nvm_version $2`
|
||||
fi
|
||||
|
||||
local NVM_VERSION_DIR
|
||||
NVM_VERSION_DIR="$(nvm_version_path "$VERSION")"
|
||||
if [ ! -d "$NVM_VERSION_DIR" ]; then
|
||||
|
|
Loading…
Reference in New Issue