Source nvm in script

This commit is contained in:
Sander Declerck 2026-01-06 10:43:15 +01:00
parent 6bbd3f5955
commit 10a2407b32
No known key found for this signature in database
2 changed files with 18 additions and 2 deletions

View file

@ -77,7 +77,15 @@ remove_volta_installation() {
# Check and uninstall nvm-managed package if present across all Node versions
remove_nvm_installation() {
# Check if nvm is available as a command
# nvm is a shell function, not a binary, so we need to source it first
if [ -s "$HOME/.nvm/nvm.sh" ]; then
# Source nvm to make it available in this script
. "$HOME/.nvm/nvm.sh" >/dev/null 2>&1
elif [ -s "$NVM_DIR/nvm.sh" ]; then
. "$NVM_DIR/nvm.sh" >/dev/null 2>&1
fi
# Check if nvm is now available
if ! command_exists nvm; then
return
fi