[patch] Update docs and add warning for 'nvm is not compatible with the npm config "prefix" option' edgecase error on Mac OS

This commit is contained in:
Dimitris Karagiannis
2020-07-20 13:27:46 +03:00
committed by Jordan Harband
parent a5aec107df
commit a01deb11dc
2 changed files with 16 additions and 0 deletions

6
nvm.sh
View File

@@ -2201,6 +2201,8 @@ nvm_die_on_prefix() {
fi
local NVM_NPM_PREFIX
local NVM_OS
NVM_OS="$(nvm_get_os)"
NVM_NPM_PREFIX="$(npm config --loglevel=warn get prefix)"
if ! (nvm_tree_contains_path "${NVM_DIR}" "${NVM_NPM_PREFIX}" >/dev/null 2>&1); then
if [ "_${NVM_DELETE_PREFIX}" = "_1" ]; then
@@ -2213,6 +2215,10 @@ nvm_die_on_prefix() {
else
nvm_err "Run \`${NVM_COMMAND}\` to unset it."
fi
if [ "${NVM_OS}" = 'darwin' ]; then
nvm_err "Make sure your username ($(whoami)) matches the one in your \$HOME path."
nvm_err "See the \"macOS Troubleshooting\" section in the docs for more information."
fi
return 10
fi
fi