Skip to content
Myr

Merge pull request #1986 from Sayegh7/master

Before adoption: this commit came in with the history the project adopted, so no landing records it.

[Fix] Make installation less restrictive when NVM_DIR is set

authored by Jordan Harband · committed by GitHub · parents 10f24d6, a56c6f1 · Browse files · 1 file+21 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+21 added−6 removed

  • other:+21 added−6 removed

1 file+21 added−6 removed

modified:install.sh+21 added-6 removed
4 unmodified lines
5nvm_has() {6 type "$1" > /dev/null 2>&17}89nvm_default_install_dir() {10 if [ -n "$XDG_CONFIG_HOME" ]; then11 printf %s "${XDG_CONFIG_HOME/nvm}"12 else13 printf %s "$HOME/.nvm"14 fi15}1617nvm_install_dir() {18 if [ -n "$NVM_DIR" ]; then19 printf %s "${NVM_DIR}"12 elif [ -n "$XDG_CONFIG_HOME" ]; then13 printf %s "${XDG_CONFIG_HOME/nvm}"20 else15 printf %s "$HOME/.nvm"21 nvm_default_install_dir22 fi23}2425nvm_latest_version() {
283 unmodified lines
309}310311nvm_do_install() {312 if [ -n "${NVM_DIR-}" ] && ! [ -d "${NVM_DIR}" ]; then313 if [ -e "${NVM_DIR}" ]; then314 echo >&2 "File \"${NVM_DIR}\" has the same name as installation directory."315 exit 1316 fi317318 if [ "${NVM_DIR}" = "$(nvm_default_install_dir)" ]; then319 mkdir "${NVM_DIR}"320 else307 echo >&2 "You have \$NVM_DIR set to \"${NVM_DIR}\", but that directory does not exist. Check your profile files and environment."308 exit 1321 echo >&2 "You have \$NVM_DIR set to \"${NVM_DIR}\", but that directory does not exist. Check your profile files and environment."322 exit 1323 fi324 fi325 if [ -z "${METHOD}" ]; then326 # Autodetect install method327 if nvm_has git; then
92 unmodified lines
420nvm_reset() {421 unset -f nvm_has nvm_install_dir nvm_latest_version nvm_profile_is_bash_or_zsh \422 nvm_source nvm_node_version nvm_download install_nvm_from_git nvm_install_node \423 install_nvm_as_script nvm_try_profile nvm_detect_profile nvm_check_global_modules \409 nvm_do_install nvm_reset424 nvm_do_install nvm_reset nvm_default_install_dir425}426427[ "_$NVM_ENV" = "_testing" ] || nvm_do_install428
1 unmodified line