From fba93c3cb995a67df9cef747d39cb69380477d81 Mon Sep 17 00:00:00 2001 From: pengzhouhu Date: Thu, 28 Nov 2019 19:09:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=BF=AB=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E9=A1=B9=E5=AE=89=E8=A3=85=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E5=9C=A8windows=E4=B8=8D=E5=85=BC=E5=AE=B9=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/taro-cli/src/mini/helper.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/taro-cli/src/mini/helper.ts b/packages/taro-cli/src/mini/helper.ts index 42d3f244e13f..c4c5eca82694 100644 --- a/packages/taro-cli/src/mini/helper.ts +++ b/packages/taro-cli/src/mini/helper.ts @@ -1,5 +1,6 @@ import * as fs from 'fs-extra' import * as path from 'path' +import * as os from 'os' import { execSync } from 'child_process' import * as _ from 'lodash' @@ -153,13 +154,26 @@ export async function prepareQuickAppEnvironment (buildData: IBuildData) { needInstall = true } if (needInstall) { + const isWindows = os.platform() === 'win32' let command if (shouldUseYarn()) { - command = 'NODE_ENV=development yarn install' + if(!isWindows) { + command = 'NODE_ENV=development yarn install' + } else { + command = 'yarn install' + } } else if (shouldUseCnpm()) { - command = 'NODE_ENV=development cnpm install' + if(!isWindows) { + command = 'NODE_ENV=development cnpm install' + } else { + command = 'cnpm install' + } } else { - command = 'NODE_ENV=development npm install' + if(!isWindows) { + command = 'NODE_ENV=development npm install' + } else { + command = 'npm install' + } } const installSpinner = ora(`安装快应用依赖环境, 需要一会儿...`).start() try {