From 703babe60a9fa09d55fbc67107a07beba09ef090 Mon Sep 17 00:00:00 2001 From: Ahmed El Sayegh Date: Mon, 21 Jan 2019 02:15:02 +0200 Subject: [PATCH] [Fix] Make installation less restrictive when NVM_DIR is set --- install.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index a9c9c16..a0d2863 100755 --- a/install.sh +++ b/install.sh @@ -304,8 +304,17 @@ nvm_check_global_modules() { nvm_do_install() { if [ -n "${NVM_DIR-}" ] && ! [ -d "${NVM_DIR}" ]; then - echo >&2 "You have \$NVM_DIR set to \"${NVM_DIR}\", but that directory does not exist. Check your profile files and environment." - exit 1 + if [ "${NVM_DIR}" == "$HOME/.nvm" ]; then + if [ -e "${NVM_DIR}" ]; then + echo >&2 "File \"${NVM_DIR}\" has the same name as installation directory." + exit 1 + else + mkdir "${NVM_DIR}" + fi + else + echo >&2 "You have \$NVM_DIR set to \"${NVM_DIR}\", but that directory does not exist. Check your profile files and environment." + exit 1 + fi fi if [ -z "${METHOD}" ]; then # Autodetect install method