-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Description
Describe the bug
Running the shadcn/ui CLI via bunx --bun to add components unexpectedly invokes Yarn through Corepack and crashes with a Corepack runtime error on Node 22.
Even though the command is executed with Bun, the CLI tries to run:
yarn add '@radix-ui/react-slot' '@radix-ui/react-dropdown-menu'
and then fails with:
TypeError: Attempted to assign to readonly property.
at runVersion (.../corepack.cjs:22422:3)
This prevents adding components via the CLI.
Affected component/components
Not a UI component — shadcn/ui CLI (dependency installation step) when adding components. How to reproduce In a project on WSL (Ubuntu), with Node 22 installed (via nvm), Bun installed: Run: bunx --bun shadcn@latest add badge breadcrumb dropdown-menu pagination table Observe the CLI attempts to execute yarn add ... through Corepack and crashes with a TypeError. Note: I’m invoking with bunx --bun, but the CLI chooses Yarn (likely via Corepack detection), which is where it fails.
How to reproduce
In a project on WSL (Ubuntu), with Node 22 installed (via nvm), Bun installed:
Run:
bunx --bun shadcn@latest add badge breadcrumb dropdown-menu pagination table
Observe the CLI attempts to execute yarn add ... through Corepack and crashes with a TypeError.
Note: I’m invoking with bunx --bun, but the CLI chooses Yarn (likely via Corepack detection), which is where it fails.
Codesandbox/StackBlitz link
No response
Logs
afrash@Afrash:~/projects/saghana$ bunx --bun shadcn@latest add badge
✔ Checking registry.
⠙ Installing dependencies.
Something went wrong. Please check the error below for more details.
If the problem persists, please open an issue on GitHub.
Command failed with exit code 1: yarn add '@radix-ui/react-slot'
22417 | process.execPath,
22418 | binPath,
22419 | ...args
22420 | ];
22421 | process.execArgv = [];
22422 | process.mainModule = void 0;
^
TypeError: Attempted to assign to readonly property.
at runVersion (/home/afrash/.nvm/versions/node/v22.16.0/lib/node_modules/corepack/dist/lib/corepack.cjs:22422:3)
at runVersion (/home/afrash/.nvm/versions/node/v22.16.0/lib/node_modules/corepack/dist/lib/corepack.cjs:22389:27)
at executePackageManagerRequest (/home/afrash/.nvm/versions/node/v22.16.0/lib/node_modules/corepack/dist/lib/corepack.cjs:22959:18)
Bun v1.2.17 (Linux x64)
afrash@Afrash:~/projects/saghana$
System Info
OS: WSL2 Ubuntu 24.04 (Noble) on Windows 11
Node: v22.16.0 (installed via nvm)
Corepack: bundled with Node 22 (active)
Bun: v1.2.17 (Linux x64)
Package manager actually invoked by CLI: Yarn (via Corepack)
shadcn/ui CLI: shadcn@latest (invoked via bunx --bun)
Shell: bash
If you need versions:
corepack yarn -v ⇒ (maintainers can request this; the error occurs before install completes)
cat package.json | jq -r .packageManager ⇒ (Bun project; CLI still chose Yarn)
Before submitting
- I've made research efforts and searched the documentation
- I've searched for existing issues