Open jakeboone02 opened 1 year ago
does this still reproduce for you? it appears to be working as of Bun 1.1.9. you may need to run bun upgrade
.
@nektro yes, still reproducible in v1.1.9:
ah I see. I was using bun index.js
instead of bun run index.js
. apologies
talking with the team it seems this is somewhat intended behavior with an unfortunate error message given how many use cases are intersecting at this CLI. bun run ...
is primarily meant for running package.json
scripts and so they take priority here. however you can signal to it that the argument is a file path with ./
or absolute paths. and we see this with bun-debug run ./index.js
producing the expected output.
I will look into making the original call work but landing it may be low priority. hope this helps and will let u know about any developments! :)
Thanks for looking into it! No rush, really.
I probably wouldn't have filed the issue except for the fact that bun --bun run test.js
works. Seemed like that and bun run test.js
should have the same behavior with regard to their arguments.
I get the same error even when the shebang specifies Bun rather than Node.
Also, relative paths that don't start with ./
give the error. E.g. src/test.js
(all platforms) and .\test.js
on Windows with \
as separator.
What version of Bun is running?
1.0.0
What platform is your computer?
Darwin 22.6.0 x86_64 i386
What steps can reproduce the bug?
Example repo: https://github.com/jakeboone02/bun-run-script
What is the expected behavior?
bun run script.js
should run as if the user rannode script.js
when the node shebang is present.What do you see instead?
bun script.js
,bun --bun script.js
, andbun --bun run script.js
run whether or not the node shebang (#!/usr/bin/env node
) is present in script.js.bun run script.js
only runs if script.js does not have the node shebang.It appears that
bun run script.js
is passing off the execution tonode
as if "script.js" is a package.json script (i.e.npm run script.js
) rather than a standalone script (i.e.node script.js
).Additional information
No response