Skip to content

Commit

Permalink
fix(cli): 修正快应用依赖项安装命令在windows不兼容问题 (#4954)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhouhu authored and luckyadam committed Dec 11, 2019
1 parent 2419ddc commit 1dca9f7
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions packages/taro-cli/src/mini/helper.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 1dca9f7

Please sign in to comment.