Skip to content

Commit

Permalink
fix(toolkits/pro): An error message is displayed when the dependency …
Browse files Browse the repository at this point in the history
…installation fails (#117)

* fix(toolkits/pro): An error message is displayed when the dependency installation fails
  • Loading branch information
liberty-zlk authored Nov 3, 2023
1 parent 7b6db16 commit a8373f0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/toolkits/pro/src/lib/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,19 +291,27 @@ export const installDependencies = (answers: ProjectInfo) => {
// egg服务端 安装依赖并启动
if (serverConfirm && serverFramework === ServerFrameworks.EggJs) {
log.info('正在安装服务端 npm 依赖,安装过程需要几十秒,请耐心等待...');
spawn.sync('npm', ['install'], {
const installServiceResult = spawn.sync('npm', ['install'], {
cwd: `${name}/${serverFramework}/`,
stdio: 'inherit',
});
log.success('服务端 npm 依赖安装成功');
if(installServiceResult.status === 0) {
log.success('服务端 npm 依赖安装成功');
}else {
throw new Error(installServiceResult.error);
}
}
// npm 依赖安装
log.info('正在安装客户端 npm 依赖,安装过程需要几十秒,请耐心等待...');
spawn.sync('npm', ['install'], {
const installClientResult = spawn.sync('npm', ['install'], {
cwd: serverConfirm ? `${name}/web` : `${name}/`,
stdio: 'inherit',
});
log.success('客户端 npm 依赖安装成功');
if(installClientResult.status === 0) {
log.success('客户端 npm 依赖安装成功');
}else {
throw new Error(installClientResult.error);
}

/* prettier-ignore-start */
console.log(
Expand Down

0 comments on commit a8373f0

Please sign in to comment.