Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[patch] Update docs and add warning for 'nvm is not compatible with t…
…he npm config "prefix" option' edgecase error on Mac OS
  • Loading branch information
mkarajohn authored and ljharb committed Aug 3, 2020
commit a01deb11dc95d908cf5223bb497fcb31a3bbd4de
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down