Browse Source

[Fix] relax `$PREFIX` checking, to accomodate `npm exec`

Fixes #2379.
Jordan Harband 4 years ago
parent
commit
e76b2945c5
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
  1. 3
      nvm.sh

3
nvm.sh

@ -2338,7 +2338,8 @@ nvm_die_on_prefix() { @@ -2338,7 +2338,8 @@ nvm_die_on_prefix() {
# npm first looks at $PREFIX (case-sensitive)
# we do not bother to test the value here; if this env var is set, unset it to continue.
if [ -n "${PREFIX-}" ]; then
# however, `npm exec` in npm v7.2+ sets $PREFIX; if set, inherit it
if [ -n "${PREFIX-}" ] && [ "$(nvm_version_path $(node -v))" != "${PREFIX}" ]; then
nvm deactivate >/dev/null 2>&1
nvm_err "nvm is not compatible with the \"PREFIX\" environment variable: currently set to \"${PREFIX}\""
nvm_err 'Run `unset PREFIX` to unset it.'

Loading…
Cancel
Save