Open Jarred-Sumner opened 4 months ago
Getting this problem as well. My work around is to use the bun create command then run bun install inside the project because it also doesn't create a bun.lock file. You can then delete the package-lock.json yourself. Hopefully they fix. For things like shadcn you will still get the issue if you try to use bun, I just use npx. Seems to still work for now
The documentation says bunx
is an alias for bun x
, and while bunx
will give me the same "Script not found" message, bun x
works just fine (Windows, v1.1.18).
Facing the same issue, if we run bunx.exe from under c:/users/
how have you been installing bun. i have never been able to reproduce this. i'd love to fix this but i have nothing to go off of.
I think I used npm to install it?
Additionally, scoop installs a bunx.cmd shim which should be unnecessary since bunx is a .exe file.
it does not?
additionally, this exe shim is part of scoop's design. if you want to avoid this indirection, you can install bun using it's powershell installer
powershell -c "irm bun.sh/install.ps1 | iex"
@Vivelin thanks for the fast reply. npm i -g bun
reproduces it, and i think this also explains what jarred was on about with it being a cmd script. that is npm's design
oh i see exactly what is happening here
this is a mistake in our packaging for npm (not a fixable issue in bun.exe)
package.json bins have bun and bunx point to the same file, which would foward the executable name as they are symbolic links. on windows, they are not symbolic links, so the binary name isn't forwarded.
a temporary fix is to npm remove -g bun
and use the above powershell script, that will also enable you to use bun upgrade
properly.
FOUND THE SOLUTION!!!
PROBLEM:
I'm using nvm on my machine so installing bun using
npm i -g bun
will create bun config files inside C:\Users\<username>\AppData\Roaming\nvm\v20.13.1
Filenames: bunx.cmd
and bunx.ps1
Then inside C:\Users\<username>\AppData\Roaming\nvm\v20.13.1\node_modules
You'll find a bun\bin
folder, now for some reason there is no bunx.exe
file here only bun.exe
file is present.
SOLUTION: Replace the line where it says
"%dp0%\node_modules\bun\bin\bun.exe" %*
with "%dp0%\node_modules\bun\bin\bunx.exe" %*
in bunx.cmd
and
# Support pipeline input if ($MyInvocation.ExpectingInput) { $input | & "$basedir/node_modules/bun/bin/bun.exe" $args } else { & "$basedir/node_modules/bun/bin/bun.exe" $args }
with
# Support pipeline input if ($MyInvocation.ExpectingInput) { $input | & "$basedir/node_modules/bun/bin/bunx.exe" $args } else { & "$basedir/node_modules/bun/bin/bunx.exe" $args }
Now to resolve the issue of missing bunx.exe you can use powershell utility to install bun then copy bunx.exe from C:\Users\<username>\.bun\bin\bunx.exe
and paste it inside C:\Users\<username>\AppData\Roaming\nvm\v20.13.1\node_modules\bun\bin
*NOTE: v20.13.1 is the selected node version in nvm when I installed bun.
bunx
prints the same help menu asbun
on Windows:Additionally, scoop installs a
bunx.cmd
shim which should be unnecessary sincebunx
is a.exe
file.