From f52831ba420e6dffb2feed74c4c0d3185ce9b155 Mon Sep 17 00:00:00 2001 From: Ashcon Partovi Date: Mon, 23 Jan 2023 23:05:46 -0800 Subject: Prevent bun from being run in slow mode --- packages/bun-npm/src/install.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/bun-npm/src/install.ts b/packages/bun-npm/src/install.ts index fbf7a76bf..9eabd2c41 100644 --- a/packages/bun-npm/src/install.ts +++ b/packages/bun-npm/src/install.ts @@ -137,15 +137,23 @@ async function downloadBun(platform: Platform, dst: string): Promise { export function optimizeBun(path: string): void { if (os === "win32") { - return; + throw new Error( + "You must use Windows Subsystem for Linux, aka. WSL, to run bun. Learn more: https://learn.microsoft.com/en-us/windows/wsl/install", + ); } const { npm_config_user_agent } = process.env; if (npm_config_user_agent && /\byarn\//.test(npm_config_user_agent)) { - return; + throw new Error( + "Yarn does not support bun, because it does not allow linking to binaries. To use bun, install using the following command: curl -fsSL https://bun.sh/install | bash", + ); } try { rename(path, join(__dirname, "bin", "bun")); + return; } catch (error) { console.debug("optimizeBun failed", error); } + throw new Error( + "Your package manager doesn't seem to support bun. To use bun, install using the following command: curl -fsSL https://bun.sh/install | bash", + ); } -- cgit v1.2.3