oven-sh / bun

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

Invalid stdio option: "[object ReadStream]" #7959

Open kkhnifes opened 8 months ago

kkhnifes commented 8 months ago

What version of Bun is running?

1.0.21

What platform is your computer?

Linux 6.6.8-200.fc39.x86_64 x86_64 unknown

What steps can reproduce the bug?

I'm encountering an issue with Astro Starlight — pagefind is not able to build.

If try to run bunx --bun astro build, I get this error:

➜  documentation git:(1-add-astro-starlight) ✗ bunx --bun  astro build     

16:22:34 Types generated 297ms
16:22:34 [build] output: "static"
16:22:34 [build] directory: /home/kkhnifes/work/firestart/documentation/public/
16:22:34 [build] Collecting build info...
16:22:34 [build] ✓ Completed in 487ms.
16:22:34 [build] Building static entrypoints...

warn - As of Tailwind CSS v2.2, `lightBlue` has been renamed to `sky`.
warn - Update your configuration file to silence this warning.

warn - As of Tailwind CSS v3.0, `warmGray` has been renamed to `stone`.
warn - Update your configuration file to silence this warning.

warn - As of Tailwind CSS v3.0, `trueGray` has been renamed to `neutral`.
warn - Update your configuration file to silence this warning.

warn - As of Tailwind CSS v3.0, `coolGray` has been renamed to `gray`.
warn - Update your configuration file to silence this warning.

warn - As of Tailwind CSS v3.0, `blueGray` has been renamed to `slate`.
warn - Update your configuration file to silence this warning.
16:22:36 [build] ✓ Completed in 2.15s.

 building client (vite) 
16:22:36 [vite] ✓ 15 modules transformed.
16:22:36 [vite] public/_astro/Tabs.astro_astro_type_script_index_0_lang.YYQMiWOA.js  0.97 kB │ gzip: 0.48 kB
16:22:36 [vite] public/_astro/page.y8mHBBe5.js                                       2.25 kB │ gzip: 1.03 kB
16:22:36 [vite] public/_astro/hoisted.hL1V9QxT.js                                    4.97 kB │ gzip: 1.85 kB
16:22:36 [vite] ✓ built in 141ms

 generating static routes 
16:22:36 λ astro-expressive-code/routes/styles.ts
16:22:36   └─ /_astro/ec.0epgx.css (+5ms)
16:22:36 λ astro-expressive-code/routes/scripts.ts
16:22:36   └─ /_astro/ec.sgewm.js (+1ms)
16:22:36 ▶ @astrojs/starlight/404.astro
16:22:36   └─ /404.html (+30ms)
16:22:36 ▶ @astrojs/starlight/index.astro
16:22:36   ├─ /de/index.html (+29ms)
16:22:36   ├─ /en/cheatsheets/azure/port-forwarding/index.html (+18ms)
16:22:36   ├─ /en/cheatsheets/kafka/reindexing-kafkaconnector/index.html (+17ms)
16:22:36   ├─ /en/index.html (+13ms)
16:22:36   ├─ /en/welcome/index.html (+10ms)
16:22:36   ├─ /de/cheatsheets/azure/port-forwarding/index.html (+13ms)
16:22:36   ├─ /de/cheatsheets/kafka/reindexing-kafkaconnector/index.html (+6ms)
16:22:37   └─ /de/welcome/index.html (+12ms)
16:22:37 ▶ /
16:22:37   └─ /index.html (+1ms)
16:22:37 ✓ Completed in 204ms.

 generating optimized images 
16:22:37   ▶ /_astro/logo.W7VDQVBF_Q4t0P.svg (reused cache entry) (+4ms) (1/1)
16:22:37 ✓ Completed in 6ms.

npm ERR! p.stdin.end is not a function. (In 'p.stdin.end()', 'p.stdin.end' is Infinity)

npm ERR! A complete log of this run can be found in: /home/kkhnifes/.npm/_logs/2024-01-02T15_22_37_265Z-debug-0.log

 validating links 
16:22:37 ✓ All internal links are valid.

16:22:37 [@astrojs/sitemap] `sitemap-index.xml` created at `public`
Failed to run pagefind via the npx wrapper: Error: Invalid stdio option "[object ReadStream]"
Please open an issue at https://github.com/CloudCannon/pagefind and paste this error message in full.
16:22:37 [build] 9 page(s) built in 3.46s
16:22:37 [build] Complete!

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

astro version: 4.0.1 starlight version: 2.0.1

Electroid commented 8 months ago

Related #4402

From @paperdave:

to implement stdio option "[object ReadStream]", edit src/js/node/child_process.js, this is a implementation of the node api using Bun.spawn. we do not handle node streams as stdio inputs. some refactoring in the code is needed to allow nonstring stdio options, but this should be pretty easy to implement. idk if that's the only thing blocking it, but if so this would be a good "good first issue" tag.

talhariaz324 commented 8 months ago

Hi @Electroid,

I have been investigating the issue, and it seems related to the pagefind build process encountering an error with the stdio option "[object ReadStream]".

From the logs, it appears that the problem arises in the src/js/node/child_process.js file, specifically in the implementation of the node API using Bun.spawn. To resolve this, we may need to handle node streams as stdio inputs and perform some refactoring in the code.

As suggested by @paperdave, this might be a good opportunity for a "good first issue" tag. I am willing to take on the task and work on the necessary changes. Any additional guidance or insights would be appreciated.

Looking forward to contributing to the resolution of this issue!

Best, @kkhnifes

ofrades commented 6 months ago

Can confirm that pagefind does not work after a bun build.

Electroid commented 4 months ago

Fixed by #10451