diff options
author | 2023-01-23 23:05:46 -0800 | |
---|---|---|
committer | 2023-01-23 23:05:46 -0800 | |
commit | f52831ba420e6dffb2feed74c4c0d3185ce9b155 (patch) | |
tree | 0cf03c246270d4551650a7bd9ffd12c0dee57abf | |
parent | ee7fe5892c2d20690827b29977166440c147f200 (diff) | |
download | bun-f52831ba420e6dffb2feed74c4c0d3185ce9b155.tar.gz bun-f52831ba420e6dffb2feed74c4c0d3185ce9b155.tar.zst bun-f52831ba420e6dffb2feed74c4c0d3185ce9b155.zip |
Prevent bun from being run in slow mode
-rw-r--r-- | packages/bun-npm/src/install.ts | 12 |
1 files 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<void> { 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", + ); } |