mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-10-31 01:45:50 +08:00
npm ls has a bug in some versions when "--parseable --depth=0" is used together.
This commit is contained in:
2
nvm.sh
2
nvm.sh
@@ -789,7 +789,7 @@ nvm() {
|
||||
|
||||
# declare local INSTALLS first, otherwise it doesn't work in zsh
|
||||
local INSTALLS
|
||||
INSTALLS=$(nvm use $VERSION > /dev/null && npm list --global --parseable --depth=0 2> /dev/null | tail -n +2 | \grep -o -e '/[^/]*$' | cut -c 2- | \grep -v npm | xargs)
|
||||
INSTALLS=$(nvm use "$VERSION" > /dev/null && npm list -g --depth=0 | tail -n +2 | \grep -o -e ' [^@]*' | cut -c 2- | \grep -v npm | xargs)
|
||||
|
||||
echo "$INSTALLS" | xargs npm install -g --quiet
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user