mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
## Summary - Removes the `#!/bin/sh` shebang from placeholder `bin/bun.exe` and `bin/bunx.exe` scripts in the npm package - Fixes `npm i -g bun` being completely broken on Windows since v1.3.7 ## Problem PR #26259 added a `#!/bin/sh` shebang to the placeholder scripts to show a helpful error when postinstall hasn't run. However, npm's `cmd-shim` reads shebangs to generate `.ps1`/`.cmd` wrappers **before** postinstall runs, and bakes the interpreter path into them. On Windows, the wrappers referenced `/bin/sh` which doesn't exist, causing: ``` & "/bin/sh$exe" "$basedir/node_modules/bun/bin/bun.exe" $args ~~~~~~~~~~~~~ The term '/bin/sh.exe' is not recognized... ``` Even after postinstall successfully replaced the placeholder with the real binary, the stale wrappers still tried to invoke `/bin/sh`. ## Fix Remove the shebang. Without it, `cmd-shim` generates a direct invocation wrapper that works after postinstall replaces the placeholder. On Unix, bash/zsh still execute shebang-less files as shell scripts via ENOEXEC fallback, so the helpful error message is preserved. ## Test plan - [x] `bun bd test test/regression/issue/24329.test.ts` passes (2/2 tests) - Manually verify `npm i -g bun` works on Windows Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
bun-release
Scripts that release Bun to npm, Dockerhub, Homebrew, etc.
Running
bun run npm # build assets for the latest release
bun run npm -- <release> # build assets for the provided release
bun run npm -- <release> [dry-run|publish] # build and publish assets to npm
Credits
- esbuild, for its npm scripts which this was largely based off of.