From abec1adc285b1668214daf71cfec43e647ad0213 Mon Sep 17 00:00:00 2001 From: Johnson Liang Date: Wed, 18 Jan 2017 14:09:21 +0800 Subject: [PATCH] [Doc] Address symbolic link issue in the error message of nvm_die_on_prefix. Fixes #1385 --- nvm.sh | 1 + test/fast/Unit tests/nvm_die_on_prefix | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nvm.sh b/nvm.sh index 35e0386..c25fc49 100755 --- a/nvm.sh +++ b/nvm.sh @@ -2010,6 +2010,7 @@ nvm_die_on_prefix() { else nvm_err "Run \`$NVM_COMMAND\` to unset it." fi + nvm_err "If \"$NVM_NPM_PREFIX\" is actually inside \"$NVM_DIR\" directory, please modify your NVM_DIR to make sure there is no any symbolic links." return 10 fi fi diff --git a/test/fast/Unit tests/nvm_die_on_prefix b/test/fast/Unit tests/nvm_die_on_prefix index 3ce4a35..4921fa4 100755 --- a/test/fast/Unit tests/nvm_die_on_prefix +++ b/test/fast/Unit tests/nvm_die_on_prefix @@ -66,7 +66,8 @@ npm() { } OUTPUT="$(nvm_die_on_prefix 0 foo 2>&1)" EXPECTED_OUTPUT="nvm is not compatible with the npm config \"prefix\" option: currently set to \"./bad prefix\" -Run \`npm config delete prefix\` or \`foo\` to unset it." +Run \`npm config delete prefix\` or \`foo\` to unset it. +If \"./bad prefix\" is actually inside \"$NVM_DIR\" directory, please modify your NVM_DIR to make sure there is no any symbolic links." EXIT_CODE="$(nvm_die_on_prefix 0 foo >/dev/null 2>&1; echo $?)" [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] || die "'nvm_die_on_prefix 0 foo' did not error with '$EXPECTED_OUTPUT' with bad prefix set; got '$OUTPUT'" [ "_$EXIT_CODE" = "_10" ] || die "'nvm_die_on_prefix 0 foo' did not exit with 10 with bad prefix set; got '$EXIT_CODE'"