oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.48k stars 2.71k forks source link

windows temp path is wrongly recognized (bunx) #13083

Open anemochore opened 1 month ago

anemochore commented 1 month ago

What version of Bun is running?

1.1.21+70ca2b76c

What platform is your computer?

Microsoft Windows NT 10.0.22621.0 x64

What steps can reproduce the bug?

I'm using Win 11, and I've installed Bun (1.1.21). When I run bun repl, the error occurs and it won't run:

error: Module not found "d:\Temp\bunx-1558969007-bun-repl@latest\node_modules\..\..\..\..\D:\Temp\bunx-1558969007-bun-repl@latest\node_modules\bun-repl\src\cli.ts"

My %TEMP% is d:\Temp. Obviously, bunx tries to mix relative and absolute paths wrongly. Other example:

> bunx --bun cross-env FOO=1 echo hi
error: Module not found "d:\Temp\bunx-1558969007-cross-env@latest\node_modules\..\..\..\..\D:\Temp\bunx-1558969007-cross-env@latest\node_modules\cross-env\src\bin\cross-env.js"

Workaround is set my %TEMP% to some relative path like . or ..\ or whatever. For example in cmd:

> set TEMP=.
> bun repl
> rem bun repl started without error

Or in PowerShell:

> $env:TEMP = '.'
> bun repl
> rem bun repl started without error

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

anemochore commented 3 days ago

Additional info: When %TEMP% is like d:\Temp (d is lower-case) bunx fails to run. However, %TEMP% is like D:\Temp (D is upper-case) bunx runs fine. Can you fix it?