Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli)修正2.0快应用依赖项安装命令在windows不兼容问题 #4954

Merged
merged 1 commit into from
Nov 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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