From 5f6dc4e5064f9f1b37ca8a2b69323502f9825d61 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 14 Jul 2021 23:30:06 -0400 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BA=8E=2007-14=2023:30?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/jd.sh b/jd.sh index 3c8a4ae..b056a76 100755 --- a/jd.sh +++ b/jd.sh @@ -944,10 +944,16 @@ detect_config_version() { ## npm install 子程序,判断是否为安卓,判断是否安装有yarn npm_install_sub() { local cmd_1 cmd_2 - type pnpm >/dev/null 2>&1 && cmd_1=pnpm || cmd_1=npm - type yarn >/dev/null 2>&1 && cmd_1=yarn || cmd_1=npm + if [[ $(type pnpm) ]] >/dev/null 2>&1; then + cmd_1=pnpm + elif [[ $(type yarn) ]] >/dev/null 2>&1; then + cmd_1=yarn + else + cmd_1=npm + fi + [[ $SYSTEM = Android ]] && cmd_2="--no-bin-links" || cmd_2="" - $cmd_1 install $cmd_2 --registry=https://registry.npm.taobao.org || $cmd_1 install $cmd_2 + $cmd_1 install $cmd_2 } ## npm install,$1:package.json文件所在路径