diff --git a/install-scripts/install-safe-chain.sh b/install-scripts/install-safe-chain.sh index 63e622e..8e184da 100755 --- a/install-scripts/install-safe-chain.sh +++ b/install-scripts/install-safe-chain.sh @@ -161,7 +161,9 @@ remove_volta_installation() { # Check and uninstall nvm-managed package if present across all Node versions remove_nvm_installation() { - # nvm is a shell function, not a binary, so we need to source it first + # This script is run in sh shell for greatest compatibility. + # Because nvm is usually setup in bash/zsh/fish startup scripts, we need to source it. + # Otherwise it won't be available in sh. if [ -s "$HOME/.nvm/nvm.sh" ]; then # Source nvm to make it available in this script . "$HOME/.nvm/nvm.sh" >/dev/null 2>&1 @@ -174,7 +176,6 @@ remove_nvm_installation() { return fi - # Get list of installed Node versions nvm_versions=$(nvm list 2>/dev/null | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' || echo "") if [ -z "$nvm_versions" ]; then diff --git a/install-scripts/uninstall-safe-chain.sh b/install-scripts/uninstall-safe-chain.sh index 15c4f96..7b226a5 100755 --- a/install-scripts/uninstall-safe-chain.sh +++ b/install-scripts/uninstall-safe-chain.sh @@ -77,7 +77,9 @@ remove_volta_installation() { # Check and uninstall nvm-managed package if present across all Node versions remove_nvm_installation() { - # nvm is a shell function, not a binary, so we need to source it first + # This script is run in sh shell for greatest compatibility. + # Because nvm is usually setup in bash/zsh/fish startup scripts, we need to source it. + # Otherwise it won't be available in sh. if [ -s "$HOME/.nvm/nvm.sh" ]; then # Source nvm to make it available in this script . "$HOME/.nvm/nvm.sh" >/dev/null 2>&1