Improve Windows Python setup guidance

This commit is contained in:
2026-04-30 03:31:43 +09:00
parent 9f2fdc1369
commit bb965c061e
4 changed files with 32 additions and 9 deletions

View File

@@ -18,7 +18,7 @@ function canRun(command: string, args: string[]): boolean {
const result = spawnSync(command, [...args, "--version"], {
encoding: "utf8",
});
return result.status === 0;
return result.error == null && result.status === 0;
}
export function resolveLocalAiVenvPath(config: AppConfig): string {
@@ -83,8 +83,9 @@ export function resolvePythonLaunch(config: AppConfig, options?: { preferVenv?:
[
"Python 실행 파일을 찾지 못했습니다.",
"1. Python 3.11 이상을 설치",
"2. 필요하면 `.env` 에 `LOCAL_AI_PYTHON=python` 또는 `LOCAL_AI_PYTHON=py -3` 설정",
"3. 그 다음 `bun run setup:local-ai` 실행",
"2. Windows면 `py -3 --version` 이 되는지 먼저 확인",
"3. 되면 `.env` 에 `LOCAL_AI_PYTHON=py -3` 설정",
"4. 그 다음 `bun run setup:local-ai` 실행",
].join("\n"),
);
}

View File

@@ -172,7 +172,21 @@ export class PythonJsonWorker {
});
child.on("error", (error) => {
this.rejectAll(error as Error);
const spawnError = error as NodeJS.ErrnoException;
if (spawnError.code === "ENOENT") {
this.rejectAll(
new Error(
[
`Python 실행에 실패했습니다: ${launch.command}`,
"Windows면 `.env` 에 `LOCAL_AI_PYTHON=py -3` 를 넣고 다시 실행하세요.",
"최초 1회는 `bun run setup:local-ai` 를 먼저 실행해야 합니다.",
].join("\n"),
),
);
return;
}
this.rejectAll(spawnError);
});
this.child = child;