[Fix] `reinstall-packages`: handle global symlink locations properly

This is a regression caused by npm ls -g in npm 7 no longer returning absolute paths.
Jordan Harband 2021-09-07 10:14:18 -07:00
parent fa63399991
commit f03f69508e
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
1 changed files with 4 additions and 1 deletions

5
nvm.sh
View File

@ -3978,7 +3978,10 @@ nvm() {
for LINK in ${LINKS}; do
set +f; unset IFS # restore variable expansion
if [ -n "${LINK}" ]; then
(nvm_cd "${LINK}" && npm link)
case "${LINK}" in
'/'*) (nvm_cd "${LINK}" && npm link) ;;
*) (nvm_cd "$(npm root -g)/../${LINK}" && npm link)
esac
fi
done
)