diff --git a/README.md b/README.md index 810fb55..a264f01 100644 --- a/README.md +++ b/README.md @@ -805,6 +805,16 @@ sudo chmod ugo-x /usr/libexec/path_helper More on this issue in [dotphiles/dotzsh](https://github.com/dotphiles/dotzsh#mac-os-x). +**nvm is not compatible with the npm config "prefix" option** + +Some solutions for this issue can be found [here](https://github.com/nvm-sh/nvm/issues/1245) + +There is one more edge case causing this issue, and that's a **mismatch between the `$HOME` path and the user's home directory's actual name**. + +You have to make sure that the user directory name in `$HOME` and the user directory name you'd see from running `ls /Users/` **are capitalized the same way** ([See this issue](https://github.com/nvm-sh/nvm/issues/2261)). + +To change the user directory and/or account name follow the instructions [here](https://support.apple.com/en-us/HT201548) + [1]: https://github.com/nvm-sh/nvm.git [2]: https://github.com/nvm-sh/nvm/blob/v0.35.3/install.sh [3]: https://travis-ci.org/nvm-sh/nvm diff --git a/nvm.sh b/nvm.sh index 98aaf97..4cdfab5 100644 --- a/nvm.sh +++ b/nvm.sh @@ -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