mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 22:31:51 +00:00
Make nvm copy-packages system
work.
This commit is contained in:
parent
ff1781b95d
commit
687df82107
10
nvm.sh
10
nvm.sh
@ -801,10 +801,18 @@ nvm() {
|
||||
return 2
|
||||
fi
|
||||
|
||||
local INSTALLS
|
||||
if [ "$PROVIDED_VERSION" = "system" ]; then
|
||||
if ! nvm_has_system_node; then
|
||||
echo 'No system version of node detected.' >&2
|
||||
return 3
|
||||
fi
|
||||
INSTALLS=$(nvm deactivate > /dev/null && npm list -g --depth=0 | tail -n +2 | \grep -o -e ' [^@]*' | cut -c 2- | \grep -v npm | xargs)
|
||||
else
|
||||
local VERSION
|
||||
VERSION="$(nvm_version "$PROVIDED_VERSION")"
|
||||
local INSTALLS
|
||||
INSTALLS=$(nvm use "$VERSION" > /dev/null && npm list -g --depth=0 | tail -n +2 | \grep -o -e ' [^@]*' | cut -c 2- | \grep -v npm | xargs)
|
||||
fi
|
||||
|
||||
echo "$INSTALLS" | xargs npm install -g --quiet
|
||||
;;
|
||||
|
Loading…
Reference in New Issue
Block a user