[Fix] nvm_die_on_prefix: use directory comparison rather than string

This commit is contained in:
Dylan Armstrong
2020-10-09 09:43:21 -05:00
committed by Jordan Harband
parent 96069da0d5
commit e01060fa2c
2 changed files with 28 additions and 2 deletions

2
nvm.sh
View File

@@ -2231,7 +2231,7 @@ nvm_die_on_prefix() {
local NVM_OS
NVM_OS="$(nvm_get_os)"
NVM_NPM_PREFIX="$(npm config --loglevel=warn get prefix)"
if [ "${NVM_VERSION_DIR}" != "${NVM_NPM_PREFIX}" ] && ! (nvm_tree_contains_path "${NVM_VERSION_DIR}" "${NVM_NPM_PREFIX}" >/dev/null 2>&1); then
if [ ! "${NVM_VERSION_DIR}" -ef "${NVM_NPM_PREFIX}" ] && ! (nvm_tree_contains_path "${NVM_VERSION_DIR}" "${NVM_NPM_PREFIX}" >/dev/null 2>&1); then
if [ "_${NVM_DELETE_PREFIX}" = "_1" ]; then
npm config --loglevel=warn delete prefix
else