Skip to content

Commit

Permalink
fix(cli): 修正快应用依赖环境安装时,因系统不同造成的命令执行问题 (#4520)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhouhu authored and luckyadam committed Sep 24, 2019
1 parent ab7fa5d commit f2274ef
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions packages/taro-cli/src/mini/index.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 chalk from 'chalk'
import * as _ from 'lodash'
Expand Down Expand Up @@ -187,13 +188,26 @@ 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 f2274ef

Please sign in to comment.