mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-11 14:51:49 +00:00
Merge c01c546359
into dc53a37d4f
This commit is contained in:
commit
475fa2e448
5
nvm.sh
5
nvm.sh
@ -531,12 +531,15 @@ nvm() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
VERSION=`nvm_version $2`
|
VERSION=`nvm_version $2`
|
||||||
local ROOT=`(nvm use $VERSION && npm -g root)`
|
local ROOT="$(nvm use $VERSION > /dev/null && npm -g root)"
|
||||||
|
echo "ROOT: $ROOT"
|
||||||
local ROOTDEPTH=$((`echo $ROOT | sed 's/[^\/]//g'|wc -m` -1))
|
local ROOTDEPTH=$((`echo $ROOT | sed 's/[^\/]//g'|wc -m` -1))
|
||||||
|
echo "ROOTDEPTH: $ROOTDEPTH"
|
||||||
|
|
||||||
# declare local INSTALLS first, otherwise it doesn't work in zsh
|
# declare local INSTALLS first, otherwise it doesn't work in zsh
|
||||||
local INSTALLS
|
local INSTALLS
|
||||||
INSTALLS=( `nvm use $VERSION > /dev/null && npm -g -p ll | \grep "$ROOT\/[^/]\+$" | cut -d '/' -f $(($ROOTDEPTH + 2)) | cut -d ":" -f 2 | \grep -v npm | tr "\n" " "` )
|
INSTALLS=( `nvm use $VERSION > /dev/null && npm -g -p ll | \grep "$ROOT\/[^/]\+$" | cut -d '/' -f $(($ROOTDEPTH + 2)) | cut -d ":" -f 2 | \grep -v npm | tr "\n" " "` )
|
||||||
|
echo "INSTALLS: $INSTALLS"
|
||||||
|
|
||||||
npm install -g ${INSTALLS[@]}
|
npm install -g ${INSTALLS[@]}
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user