Skip to content

Commit f03f695

Browse files
committed
[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.
1 parent fa63399 commit f03f695

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nvm.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -3978,7 +3978,10 @@ nvm() {
39783978
for LINK in ${LINKS}; do
39793979
set +f; unset IFS # restore variable expansion
39803980
if [ -n "${LINK}" ]; then
3981-
(nvm_cd "${LINK}" && npm link)
3981+
case "${LINK}" in
3982+
'/'*) (nvm_cd "${LINK}" && npm link) ;;
3983+
*) (nvm_cd "$(npm root -g)/../${LINK}" && npm link)
3984+
esac
39823985
fi
39833986
done
39843987
)

0 commit comments

Comments
 (0)