ui icon indicating copy to clipboard operation
ui copied to clipboard

Error with installing packages trough the CLI with Bun

Open LukaHietala opened this issue 5 months ago • 6 comments

I noticed a strange problem when using the CLI to add components or to initialize a project. It fails to install the new dependencies and gives an error that looks like this:

Command failed with exit code 1: npm install [DEPENDENCY NAME]
npm ERR! fh.read is not a function. (In 'fh.read(buf, 0, 2048, 0)', 'fh.read' is undefined)

Or:

Invalid stdio option "undefined"

Commands with this issue:

bunx --bun shadcn-ui@latest init
bunx --bun shadcn-ui@latest add [ANY COMPONENT THAT ADDS NEW DEPENDENCIES]

It adds the component files normally, so it's not completely unusable, but you just have to install the new dependencies manually.

LukaHietala avatar Jan 06 '24 17:01 LukaHietala

similar issue when using bun for the cli

❯ bunx --bun shadcn-ui@latest add navigation-menu
⠋ Installing components...Command failed: bun add @radix-ui/react-navigation-menu
Invalid stdio option "undefined"

it creates the component, just fails adding packages

biohackerellie avatar Jan 18 '24 17:01 biohackerellie

I'm actually getting this error when I try to init shadcn:

$ bunx --bun shadcn-ui@latest init

✔ Which style would you like to use? › Default
✔ Which color would you like to use as base color? › Zinc
✔ Would you like to use CSS variables for colors? … no / yes

✔ Writing components.json...
✔ Initializing project...
⠋ Installing dependencies...Command failed: bun add tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react
Invalid stdio option "undefined"

bassamanator avatar Jan 19 '24 03:01 bassamanator

similar issue when using bun for the cli

❯ bunx --bun shadcn-ui@latest add navigation-menu
⠋ Installing components...Command failed: bun add @radix-ui/react-navigation-menu
Invalid stdio option "undefined"

it creates the component, just fails adding packages

Yes, I'm getting that as well

LukaHietala avatar Jan 19 '24 19:01 LukaHietala

Strangely, the problem does not occur in Github Codespaces

LukaHietala avatar Jan 21 '24 12:01 LukaHietala

I'm running into an issue as well but I don't quite have the same error, mine seems to be related to worker_threads implementation, there is an existing similar issue in the bun repo https://github.com/oven-sh/bun/issues/4165

Screenshot 2024-01-24 at 12 57 46

pnodet avatar Jan 24 '24 05:01 pnodet

Same issue here with bun... at the CSS variables step.

dejoma avatar Jan 28 '24 17:01 dejoma

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

shadcn avatar Feb 19 '24 23:02 shadcn

This issue hasn't been fix. I don't see the point of closing it.

pnodet avatar Feb 20 '24 05:02 pnodet

I also have this issue, but maybe it is because bun has to support it, is there no issue at bun's side?

ikbenignace avatar Mar 05 '24 19:03 ikbenignace

I'm working on other things right now, but have you guys done a bun upgrade recently?

bassamanator avatar Mar 06 '24 05:03 bassamanator

I was having the same issue but after bun upgrade from v1.0.22 to v1.0.30 everything seems to be good now!

image

alDuncanson avatar Mar 09 '24 03:03 alDuncanson

I'm actually getting this error when I try to init shadcn:

$ bunx --bun shadcn-ui@latest init

✔ Which style would you like to use? › Default
✔ Which color would you like to use as base color? › Zinc
✔ Would you like to use CSS variables for colors? … no / yes

✔ Writing components.json...
✔ Initializing project...
⠋ Installing dependencies...Command failed: bun add tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react
Invalid stdio option "undefined"

Hello sir, I'm facing the same problem, Can you help me fix it?

TranNguyenpls avatar Apr 27 '24 08:04 TranNguyenpls

I'm actually getting this error when I try to init shadcn:

$ bunx --bun shadcn-ui@latest init

✔ Which style would you like to use? › Default
✔ Which color would you like to use as base color? › Zinc
✔ Would you like to use CSS variables for colors? … no / yes

✔ Writing components.json...
✔ Initializing project...
⠋ Installing dependencies...Command failed: bun add tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react
Invalid stdio option "undefined"

Hello sir, I'm facing the same problem, Can you help me fix it?

Upgrade Bun with bun upgrade to fix that issue

LukaHietala avatar Apr 27 '24 11:04 LukaHietala